(shape: ArrayShape, slice: Slice)
| 5 | use std::iter::repeat; |
| 6 | |
| 7 | pub(super) fn get_slice_shape(shape: ArrayShape, slice: Slice) -> Result<ArrayShape> { |
| 8 | let clean_slice = get_clean_slice(shape.clone(), slice)?; |
| 9 | let mut result_shape = vec![]; |
| 10 | for i in 0..shape.len() { |
| 11 | if i < clean_slice.len() { |
| 12 | if let Some(s) = get_slice_shape_1d(shape[i], clean_slice[i].clone())? { |
| 13 | result_shape.push(s); |
| 14 | } |
| 15 | } else { |
| 16 | result_shape.push(shape[i]); |
| 17 | } |
| 18 | } |
| 19 | Ok(result_shape) |
| 20 | } |
| 21 | |
| 22 | /// Assumes that `slice` is a correct slice, in particular that |
| 23 | /// `get_slice_shape(shape, slice)` does not return an error. |
no test coverage detected