Skip to main content

Shape

Type Alias Shape 

Source
pub type Shape = Vec<Dim>;
Expand description

A tensor shape: an ordered list of Dims.

A rank-0 (scalar) shape is the empty vector. The IR Shape therefore always denotes a known rank; it does not carry a distinct “unknown rank” inhabitant (ONNX tensor_type.shape entirely absent). The loader maps an absent TensorShapeProto to an empty Shape, so unknown-rank values are currently indistinguishable from rank-0 scalars — an accepted limitation for the dense fp / quantized models the runtime targets, where value types carry shapes. Distinguishing the two would require making Value::shape optional across the frozen IR contract and is deliberately out of scope here. Known, per-axis unknown dimensions (of a known rank) are fully modeled via Dim::Symbolic.

Aliased Type§

pub struct Shape { /* private fields */ }