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

ActionSet

ActionSet​

class max.experimental.sharding.ActionSet(axis_assignments, layouts, mesh, extras=(), result_shape=None, finalize=None, finalize_ctx=None)

source

Bases: object

A rule’s menu of per-axis sharding options for one op call.

Shape-aware (it depends on operand layouts) but cost-blind: it lists what is possible, not what is cheapest. The dispatcher picks one entry per mesh axis.

Parameters:

axis_assignments​

axis_assignments: tuple[AxisAssignment, ...]

source

Per-axis rows, each pickable independently per mesh axis. The last entry is the universal (R,…,R) -> R fallback.

extras​

extras: tuple[Any, ...] = ()

source

Non-tensor positional args appended after tensor-input mappings in the picked Action’s inputs. A bare value is treated as uniform across ranks; wrap in PerShard to vary per rank.

finalize​

finalize: Callable[[Action, Any], Action] | None = None

source

Optional post-pick transform applied as finalize(action, finalize_ctx). Used by rules that need the picked placement to compute per-rank metadata or repack inputs into a user-facing container.

finalize_ctx​

finalize_ctx: Any = None

source

Opaque per-op context passed to finalize.

layouts​

layouts: tuple[TensorLayout, ...]

source

Per-tensor input layouts this menu was built for.

mesh​

mesh: DeviceMesh

source

The mesh both the picker and planner work over.

result_shape​

result_shape: Sequence[Dim] | None = None

source

Output shape constraint, set by reshape-style rules. Lets the feasibility check reject output Sharded rows whose result dim is too small.