For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Python class
AlgebraicDim
AlgebraicDim
class max.graph.AlgebraicDim(value)
Bases: Dim
A dimension defined by an expression over symbolic dimensions.
Arithmetic on symbolic dimensions produces an AlgebraicDim:
from max.graph import AlgebraicDim, Dim
isinstance(Dim("batch") * 5, AlgebraicDim) # TrueEquivalent expressions simplify to the same form:
from max.graph import Dim
Dim("x") + 1 + 1 == Dim("x") + 2 # TrueConverts valid input values to Dim.
-
Parameters:
-
attr (ParamOperatorAttr)
apply()
classmethod apply(op, *operands)
Applies a parametric operator to operands and returns the resulting dimension.
attr
attr: ParamOperatorAttr
from_mlir()
static from_mlir(attr)
Constructs an AlgebraicDim from a kgen.ParamOperatorAttr.
-
Parameters:
-
attr (TypedAttr) – The
kgen.ParamOperatorAttrto parse into anAlgebraicDim. -
Returns:
-
The
AlgebraicDimrepresented by thekgen.ParamOperatorAttr. -
Return type:
parameters
property parameters: Iterable[SymbolicDim]
Lists the symbolic dimension names on which this dim depends.
substitute()
substitute(mapping)
Returns this dim with named symbols replaced per mapping.
Substitutes into each operand, then reapplies the operator, so substitution to static values folds through the compiler’s own attribute evaluation rather than being recomputed in Python.
-
Parameters:
-
mapping (Mapping[str, int | str | Dim | integer | TypedAttr]) – A mapping from symbolic dimension name to the replacement dim (or dim-like value).
-
Returns:
-
The dim with substitutions applied, re-folded by the compiler.
-
Raises:
-
ZeroDivisionError – If substitution produces a zero divisor.
-
Return type:
to_mlir()
to_mlir()
Creates an mlir.Attribute representing this dimension.
This is used internally when constructing tensor MLIR types.
-
Returns:
-
An mlir.Attribute in the context representing the dimension.
-
Return type:
-
ParamOperatorAttr