Python class
SymbolicDim
SymbolicDim
class max.graph.SymbolicDim(value)
Bases: Dim
A symbolic tensor dimension with an unknown size identified by name.
When you don’t know a dimension value at compile time, you can use a symbolic dimension. This helps you identify dimensions by name and lets the compiler optimize operations when two or more dimensions share the same name.
The following example creates a symbolic dimension implicitly passing the
strings "batch" and "x" to TensorType:
tensor_type = TensorType(DType.float32, ("batch", "x", 10), device=DeviceRef.CPU())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!