If `cmp` is an array, add `1` to the shape by reshaping, otherwise, do nothing. This helper function is necessary for min/max, since we need to pad the shape of the result of the comparison in order to be able to call mux later.
(cmp: Node)
| 54 | /// we need to pad the shape of the result of the comparison |
| 55 | /// in order to be able to call mux later. |
| 56 | fn normalize_cmp(cmp: Node) -> Result<Node> { |
| 57 | let cmp_type = cmp.get_type()?; |
| 58 | let normalized_cmp = if cmp_type.is_array() { |
| 59 | let mut new_shape = cmp_type.get_shape(); |
| 60 | let st = cmp_type.get_scalar_type(); |
| 61 | new_shape.push(1); |
| 62 | cmp.reshape(array_type(new_shape, st))? |
| 63 | } else { |
| 64 | cmp |
| 65 | }; |
| 66 | Ok(normalized_cmp) |
| 67 | } |
| 68 | |
| 69 | #[typetag::serde] |
| 70 | impl CustomOperationBody for Min { |
no test coverage detected