Python class
PlacementMapping
PlacementMappingβ
class max.experimental.sharding.PlacementMapping(_mesh, _placements)
Bases: DeviceMapping
Mesh-axis-indexed sharding (PyTorch DTensor style).
Stores one Placement per mesh axis. Each placement describes
what that mesh axis does to the tensor: Shard(dim), Replicate(),
or Partial(op).
This is always fully resolved and can be used directly in eager dispatch.
-
Parameters:
-
- _mesh (DeviceMesh) β The device mesh.
- _placements (tuple[Placement, ...]) β One placement per mesh axis.
is_fully_replicatedβ
property is_fully_replicated: bool
Returns True if every mesh axis placement is Replicated.
is_fully_resolvedβ
property is_fully_resolved: bool
Returns True; placement mappings are always fully concrete.
meshβ
property mesh: DeviceMesh
The device mesh this sharding is defined over.
placementsβ
The raw placement tuple (one per mesh axis).
to_named_sharding()β
to_named_sharding(tensor_rank)
Converts to a tensor-dim-indexed NamedMapping.
-
Raises:
-
ConversionError β If any placement is not one of the standard types (
Replicated,Sharded,Partial). -
Parameters:
-
tensor_rank (int)
-
Return type:
to_placements()β
to_placements()
Returns the stored placement tuple directly.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!