Python class
StaticDim
StaticDim
class max.graph.StaticDim(value)
Bases: Dim
A static tensor dimension with a fixed size.
Because a static dimension’s size is fixed, related computation can be optimized at compile time. This is key to good model performance.
The following example creates static dimensions implicitly by passing
integer values to TensorType:
from max.graph import TensorType
from max.dtype import DType
tensor = TensorType(DType.int64, (4, 5))Converts valid input values to Dim.
-
Parameters:
-
dim (int)
dim
dim: int
The size of the static dimension.
from_mlir()
static from_mlir(attr)
Constructs a StaticDim from a builtin.IntegerAttr.
-
Parameters:
-
attr (TypedAttr) – The
builtin.IntegerAttrto parse into aStaticDim. -
Returns:
-
The
StaticDimrepresented by thebuiltin.IntegerAttr. -
Return type:
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:
-
IntegerAttr
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!