Panics if `x` is not an array.
(x: Node)
| 103 | |
| 104 | /// Panics if `x` is not an array. |
| 105 | pub fn put_in_bits(x: Node) -> Result<Node> { |
| 106 | let shape = x.get_type()?.get_dimensions(); |
| 107 | if shape.len() == 1 { |
| 108 | Ok(x) |
| 109 | } else { |
| 110 | let mut axes_permutation: Vec<u64> = (1..shape.len()).map(|x| x as u64).collect(); |
| 111 | axes_permutation.push(0); |
| 112 | Ok(x.permute_axes(axes_permutation)?) |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | pub fn zeros_like(x: Node) -> Result<Node> { |
| 117 | x.get_graph().zeros(x.get_type()?) |
no test coverage detected