IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
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

Placement

Placement​

class max.experimental.sharding.Placement

source

Bases: ABC

Abstract base for all placement types.

Each placement describes what a single mesh axis does to a tensor: Replicated (full copy), Sharded (split along a tensor dim), or Partial (partial result needing reduction).

global_dim()​

global_dim(cells)

source

Combines per-shard cells along this mesh axis into one global Dim.

The default returns cells unchanged (every shard holds the same dim). Sharded overrides to sum the cells.

Parameters:

cells (Dim)

Return type:

Dim

local_dim()​

local_dim(parent, mesh, mesh_axis, *, allow_symbolic_mint=True)

source

Returns the per-shard local cells of parent along this mesh axis.

The default returns parent unchanged; Sharded overrides to split. A wrapper parent is passed through verbatim.

Parameters:

  • parent (int | str | Dim | integer | TypedAttr) – The global dim to localize.
  • mesh (DeviceMesh) – The device mesh.
  • mesh_axis (int) – The mesh axis index being localized.
  • allow_symbolic_mint (bool) – When False, refuse to mint fresh per-shard symbols from a bare SymbolicDim. Reshape propagation passes False.

Return type:

Dim

localized_axis()​

localized_axis()

source

Tensor axis this placement localizes, or None if it doesn’t.

Return type:

int | None

transition_to()​

transition_to(other)

source

Returns the Collective for self -> other.

Parameters:

other (Placement)

Return type:

Collective