pub enum ValueType {
Tensor(TensorType),
Sequence(Box<ValueType>),
Optional(Box<ValueType>),
Map(DataType, Box<ValueType>),
}Expand description
The full type of a value: a tensor, or a container whose element type is
itself a ValueType.
ONNX values are tensors in the overwhelming majority of graphs; the tensor
path never materialises a ValueType at all (a value with no recorded
ValueType is, by construction, a plain tensor). The container variants
exist only so Sequence/Optional/Map operators can propagate their
element types. This layer is additive: it wraps, and never replaces,
TypeInfo, so the tensor-only path stays byte-identical.
Variants§
Tensor(TensorType)
A tensor value.
Sequence(Box<ValueType>)
A homogeneous sequence of element-typed values.
Optional(Box<ValueType>)
An optional value that is either present as element or absent.
Map(DataType, Box<ValueType>)
A map from key (an integer or string dtype) to value-typed values.
Implementations§
Source§impl ValueType
impl ValueType
Sourcepub fn tensor(dtype: DataType, shape: TypedShape) -> Self
pub fn tensor(dtype: DataType, shape: TypedShape) -> Self
A tensor value with a known shape.
Sourcepub fn as_tensor(&self) -> Option<&TensorType>
pub fn as_tensor(&self) -> Option<&TensorType>
The tensor leaf, when this value is a tensor.
Sourcepub fn as_sequence_element(&self) -> Option<&ValueType>
pub fn as_sequence_element(&self) -> Option<&ValueType>
The element type, when this value is a sequence.