Skip to main content

reorder_dims

Function reorder_dims 

Source
pub fn reorder_dims(
    dims: &[i64],
    from: MemoryLayout,
    to: MemoryLayout,
) -> Vec<i64>
Expand description

Reorder 4-D shape dimensions from one layout to another.

Given dimensions in from layout order, returns them in to layout order. For example, if from = NCHW and the dims are [N, C, H, W], converting to NHWC gives [N, H, W, C].

Non-4-D shapes are returned unchanged, as are shapes where no permutation applies (same layout, or non-spatial layout pair).