pub fn collapse_dims<const N: usize>(
shape: &[usize],
strides: [&[isize]; N],
) -> (Vec<usize>, [Vec<isize>; N])Expand description
Merges adjacent dimensions that are contiguous for every operand and drops unit dimensions, so that common layouts iterate as one flat loop.
Dimension d merges into d + 1 when strides[d] == strides[d + 1] * shape[d + 1]
holds for every operand.