Skip to main content

conv_dimension_numbers

Function conv_dimension_numbers 

Source
pub fn conv_dimension_numbers(lhs: &str, rhs: &str, out: &str) -> ConvDims
Expand description

Converts string dimension numbers such as ("NHWC", "HWIO", "NHWC") to ConvDims (lax.conv_dimension_numbers): N and C are the batch and feature dimensions of the input and the output, O and I the output and input feature dimensions of the kernel, and other characters name spatial dimensions, which are ordered as in the kernel’s spec.

§Examples

use ruxla_core::lax;

let d = lax::conv_dimension_numbers("NHWC", "HWIO", "NHWC");
assert_eq!(d.lhs_spec, [0, 3, 1, 2]);
assert_eq!(d.rhs_spec, [3, 2, 0, 1]);

§Panics

Panics if the specs are malformed (as JAX raises).