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 function

mode

mode()

max.experimental.sharding.mode(solver)

source

Binds solver for the duration of a with block or function call.

Usable both as a context manager with mode(S): and as a decorator @mode(S)contextlib.contextmanager() returns a ContextDecorator that supports both. solver must be a Solver instance (one of GreedyReshard, NoReshard, PartialsOnly, or any callable matching the Solver protocol).

Parameters:

solver (Callable[[ActionSet, Sequence[TensorLayout]], Action])

Return type:

Iterator[Callable[[ActionSet, Sequence[TensorLayout]], Action]]