For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Python class
TensorLayout
TensorLayout
class max.experimental.sharding.TensorLayout(dtype, shape, mapping)
Bases: DeviceMapping
Metadata snapshot of a distributed tensor for rule evaluation.
Bundles the tensor’s dtype, shape, and distribution mapping. The mapping
stays abstract (DeviceMapping) so rules work with any concrete
mapping type, such as PlacementMapping or NamedMapping.
The shape is a Shape (list[Dim]), supporting both
static and symbolic dimensions for graph compilation compatibility.
This class implements DeviceMapping, so sharding rules can return input TensorLayouts directly.
-
Parameters:
-
- dtype (DType)
- shape (Shape)
- mapping (DeviceMapping)
dtype
dtype: DType
The element data type of the tensor.
mapping
mapping: DeviceMapping
The distribution mapping over the device mesh.
rank
property rank: int
The number of dimensions.
shape
shape: Shape
The global shape of the tensor.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!