Skip to main content

Python class

StaticDim

StaticDim

class max.graph.StaticDim(value)

source

Bases: Dim

A static tensor dimension.

Static tensor dimensions will always have exactly the same value, and are key to good model performance.

The following example shows how static dimensions can be created implicitly:

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

source

The size of the static dimension.

from_mlir()

static from_mlir(attr)

source

Constructs a StaticDim from a builtin.IntegerAttr.

Parameters:

attr (TypedAttr) – The builtin.IntegerAttr to parse into a StaticDim.

Returns:

The StaticDim represented by the builtin.IntegerAttr.

Return type:

StaticDim

parameters

property parameters: Iterable[SymbolicDim]

source

Lists the symbolic dimension names on which this dim depends.

to_mlir()

to_mlir()

source

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:

IntegerAttr