Panics if `x` is not an array.
(x: Node)
| 44 | |
| 45 | /// Panics if `x` is not an array. |
| 46 | pub fn pull_out_bits(x: Node) -> Result<Node> { |
| 47 | let shape = x.get_type()?.get_dimensions(); |
| 48 | if shape.len() == 1 { |
| 49 | Ok(x) |
| 50 | } else { |
| 51 | let mut axes_permutation = vec![shape.len() as u64 - 1]; |
| 52 | axes_permutation.extend(0..shape.len() as u64 - 1); |
| 53 | Ok(x.permute_axes(axes_permutation)?) |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | pub fn pull_out_bits_for_type(t: Type) -> Result<Type> { |
| 58 | if !t.is_array() { |
no test coverage detected