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).

zipped_divide

zipped_divide(layout_a: Layout, layout_b: Layout) -> Layout

Divides a layout into blocks according to another layout.

This function creates a hierarchical layout by dividing the first layout according to the second layout. It's an alias for hierarchical_unzip that provides a more intuitive name for the division operation. This is useful for creating blocked or tiled representations of tensors.

Example:

from layout import Layout, IntTuple
from layout.layout import zipped_divide

# Create layouts
var base = Layout.row_major(6, 8)
var pattern = Layout(IntTuple(2, 2))
var result = zipped_divide(base, pattern)

Args:

  • layout_a (Layout): The layout to be divided.
  • layout_b (Layout): The layout defining the division pattern.

Returns:

Layout: A new layout representing the hierarchical division of layout_a according to layout_b.

zipped_divide(layout_a: Layout, tiler: List[Layout]) -> Layout

Divides a layout into blocks according to a list of layouts.

This function creates a hierarchical layout by dividing the first layout according to the layouts in the tiler list. It's an alias for hierarchical_unzip that provides a more intuitive name for the division operation when working with multiple tiling patterns.

Example:

from layout import Layout, LayoutList, IntTuple
from layout.layout import zipped_divide

# Create layouts
var base = Layout.row_major(6, 8)
var tilers = LayoutList()
tilers.append(Layout(IntTuple(2, 2)))
var result = zipped_divide(base, tilers)

Args:

  • layout_a (Layout): The layout to be divided.
  • tiler (List[Layout]): A list of layouts defining the division patterns.

Returns:

Layout: A new layout representing the hierarchical division of layout_a according to the patterns in tiler.