Skip to main content

dim_order

Function dim_order 

Source
pub fn dim_order(shape: &[usize], strides: &[usize]) -> Option<DimOrder>
Expand description

The dimension order of a tensor that is dense in memory, or None if it is not dense.

Dense means the strides are exactly a permutation of contiguous strides: no gaps, no overlap, no broadcasting. Use nested_dim_order when only an iteration order is needed and gaps in storage are acceptable.

Dimensions of size one are ignored while checking density — their stride is arbitrary and carries no traffic — but they keep a position in the returned order so it stays a permutation of 0..rank.