IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: 1.0.0b1
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

sublayout

sublayout(layout: Layout, *modes: Int) -> Layout

Creates a sublayout by selecting specific dimensions from a layout.

This function extracts a subset of dimensions from a layout to create a new layout with lower rank. For example, from a 3D layout, you could extract a 2D layout containing only the first and third dimensions.

Example:

From a layout with shape (3,4,5), sublayout(layout, 0, 2) would create a layout with shape (3,5).

Args:

  • layout (Layout): The source layout to extract dimensions from.
  • *modes (Int): The indices of dimensions to include in the sublayout.

Returns:

Layout: A new layout containing only the specified dimensions.