Python class
SymbolicDim
SymbolicDim
class max.graph.SymbolicDim(value)
Bases: Dim
A symbolic tensor dimension.
Symbolic dimensions represent named dimensions in MO tensor types.
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.
In tensor type notation:
!mo.tensor<[batch, x, 10], si32]>The first and second dimensions are named batch and x respectively.
Creating a SymbolicDim:
dim = SymbolicDim("name")Using SymbolicDim in a TensorType:
tensor_type = TensorType(DType.bool, (SymbolicDim("batch"), SymbolicDim("x"), 10))Converts valid input values to Dim.
-
Parameters:
-
name (str)
from_mlir()
static from_mlir(attr)
Constructs a SymbolicDim from a kgen.ParamDeclRefAttr.
-
Parameters:
-
attr (TypedAttr) – The
kgen.ParamDeclRefAttrto parse into aSymbolicDim. -
Returns:
-
The
SymbolicDimrepresented by thekgen.ParamDeclRefAttr. -
Return type:
name
name: str
The name of the dimension.
parameters
property parameters: Iterable[SymbolicDim]
Lists the symbolic dimension names on which this dim depends.
to_mlir()
to_mlir()
Creates an mlir.Attribute representing this dimension.
This is used internally when constructing tensor MLIR types.
-
Returns:
-
An
mlir.Attributein the context representing the dimension. -
Return type:
-
ParamDeclRefAttr
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!