(x: Tensor<B, 1>)
| 160 | } |
| 161 | |
| 162 | pub fn tensor_to_array_2<B: Backend>(x: Tensor<B, 1>) -> [usize; 2] { |
| 163 | let vec: Vec<<B as Backend>::FloatElem> = x.into_data().to_vec().unwrap(); |
| 164 | assert!(vec.len() == 2, "Tensor length must be 2."); |
| 165 | [vec[0].to_usize(), vec[1].to_usize()] |
| 166 | } |
| 167 | |
| 168 | pub fn tensor_to_array<const N: usize, B: Backend>(x: Tensor<B, 1>) -> [usize; N] { |
| 169 | let vec: Vec<<B as Backend>::FloatElem> = x.into_data().to_vec().unwrap(); |
no outgoing calls
no test coverage detected