IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /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. /get-started.md).

Python package

max.experimental

Experimental APIs for building, sharding, and running ML workloads.

Built on top of max.graph and max.driver, in three layers that each consume the one below:

  • nn – the Module base class plus ahead-of-time compilation to a CompiledCallable.
  • functional – a one-function-per-op distributed dispatcher (F.matmul, F.add, …).
  • sharding – placements, the device mesh, the action data model, a cost model, and the auto_reshard policy.

The distributed Tensor ties them together. The following example calls Tensor.ones() to build a 4x8 tensor and passes it to F.matmul along with its transpose:

from max.experimental import Tensor
from max.experimental import functional as F

x = Tensor.ones((4, 8))
y = F.matmul(x, x.T)

Modules​

max.experimental.compilationTraces and compiles Python functions over tensors.
max.experimental.customUser-facing definitions of custom ops for eager and graph use.
max.experimental.executorExecutor protocol and concrete implementations for eager graph execution.
max.experimental.functionalDistributed functional ops with explicit per-op SPMD dispatch.
max.experimental.nnModule framework for max.experimental.
max.experimental.nn.normNormalization layers for MAX neural networks.
max.experimental.nn.ropePositional embedding modules and functions.
max.experimental.randomProvides random tensor generation utilities.
max.experimental.realization_contextImplementations of various realization strategies.
max.experimental.shardingDefines how a tensor is laid out across a device mesh and how ops reshard it.
max.experimental.sharding.per_shard_dimPer-shard Dim wrapper carrying one value per device.
max.experimental.tensorProvides tensor operations with eager execution capabilities.
max.experimental.testingTesting utilities for the experimental Tensor API.
max.experimental.torchBridge between PyTorch and MAX graphs.
max.experimental.validationGuard rails for running eager code in production.

Custom operations​

CustomOpA declared custom op; call it eagerly or in a graph.