(&self, context: Context, arguments_types: Vec<Type>)
| 69 | #[typetag::serde] |
| 70 | impl CustomOperationBody for Min { |
| 71 | fn instantiate(&self, context: Context, arguments_types: Vec<Type>) -> Result<Graph> { |
| 72 | if arguments_types.len() != 2 { |
| 73 | return Err(runtime_error!("Invalid number of arguments for Min")); |
| 74 | } |
| 75 | let g = context.create_graph()?; |
| 76 | let i1 = g.input(arguments_types[0].clone())?; |
| 77 | let i2 = g.input(arguments_types[1].clone())?; |
| 78 | let cmp = g.custom_op( |
| 79 | CustomOperation::new(GreaterThan { |
| 80 | signed_comparison: self.signed_comparison, |
| 81 | }), |
| 82 | vec![i1.clone(), i2.clone()], |
| 83 | )?; |
| 84 | let normalized_cmp = normalize_cmp(cmp)?; |
| 85 | let o = g.custom_op(CustomOperation::new(Mux {}), vec![normalized_cmp, i2, i1])?; |
| 86 | g.set_output_node(o)?; |
| 87 | g.finalize()?; |
| 88 | Ok(g) |
| 89 | } |
| 90 | |
| 91 | fn get_name(&self) -> String { |
| 92 | format!("Min(signed_comparison={})", self.signed_comparison) |
nothing calls this directly
no test coverage detected