Skip to main content

min_dim

Function min_dim 

Source
pub fn min_dim(dims: &[usize]) -> usize
Expand description

Get the minimum dimension from a slice of dimensions.

Returns 1 for an empty slice. This is used for DiagTensor where all indices must have the same dimension.

ยงExamples

use tensor4all_tensorbackend::min_dim;

assert_eq!(min_dim(&[2, 3, 4]), 2);
assert_eq!(min_dim(&[5, 5, 5]), 5);
assert_eq!(min_dim(&[]), 1);