Skip to main content

Mojo function

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:

A new layout containing only the specified dimensions.

Was this page helpful?