Mojo struct
SymbolicDim
A symbolic tensor dimension.
SymbolicDims
s have a name and are printed as their name on MO types, eg.
!mo.tensor<[batch, x, 10], si32]>
the first and second dimensions are
named "batch" and "x" respectively.
Symbolic dimensions don't have a static value, but they allow a readable name to understand what's going on in the model IR better, and they also allow users to hint to the compiler that two dimensions will have the same value, which can often allow important speedups.
Create a symbolic dimension via Dim.symbolic("name")
, or just by passing
the string name, eg. TensorType(DType.bool, "batch", Dim.dynamic(), 10)
.
Fields
- name (
String
): The name of the dimension.
Implemented traits
AnyType
,
CollectionElement
,
Copyable
,
Movable
Methods
__eq__
__eq__(self: Self, other: Self) -> Bool
Whether the dimension is the same as another symbolic dimension.
Symbolic dimensions with the same name are interpreted as the same dimensionality! If you use Symbolic dimensions, make sure you're naming them consistently, your model will likely fail to compile if you name two actually different dimensions the same name.
Args:
- other (
Self
): The other dimension to check equality against.
Returns:
True if the dimensions have the same name, False otherwise.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!