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 function

as_layout

as_layout()

max.experimental.sharding.as_layout(layout)

source

Normalizes a declared layout.

Takes a declaration, never a value: a live tensor’s dims are whatever it currently holds, so reading a layout off one would fix every dimension to that. Anything holding a layout of its own is refused, and told to pass it.

A single-device max.graph type is accepted and coerced, so the graph types stay usable without appearing in any signature. A BufferType coerces to a BufferLayout, carrying its declaration across.

Parameters:

layout (object) – A TensorLayout or BufferLayout to take as given, or a single-device TensorType or BufferType.

Returns:

The equivalent layout.

Raises:

TypeError – If layout is a value rather than a declaration, or describes no layout at all.

Return type:

TensorLayout