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
Type
Typeβ
class max.graph.Type
Bases: Generic[MlirType]
The type of any value in a MAX graph.
Every value in the graph has a type, and that type is represented by a Type.
This type may be inspected to get finer-grained types and learn more
about an individual Value.
The following example shows how to inspect a tensor type:
from max.dtype import DType
from max.graph import DeviceRef, TensorType
tensor_type = TensorType(DType.float32, [2, 3], device=DeviceRef.CPU())
print(f"Tensor element type: {tensor_type.dtype}") # Outputs: DType.float32
print(f"Tensor shape: {tensor_type.shape}") # Outputs: [Dim(2), Dim(3)]from_mlir()β
static from_mlir(t)
Constructs a type from an MLIR type.
to_mlir()β
to_mlir()
Converts to an mlir.Type instance.
-
Returns:
-
An
mlir.Typein the specified Context. -
Return type:
-
MlirType