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

Mojo function

apply_tiler

def apply_tiler[func: def(var Layout, var Layout) thin -> Layout](var layout_a: Layout, tiler: List[Layout]) -> Layout

Applies a layout transformation function to each element of a layout with a tiler.

This utility function applies the specified transformation function to each corresponding pair of elements from the layout and tiler list. It's a generic mechanism for implementing various tiling operations.

Example:

from layout import Layout, LayoutList, IntTuple
from layout.layout import apply_tiler, logical_divide

# Apply logical_divide to each element of a layout with a tiler
var base = Layout.row_major(6, 8)
var tilers = LayoutList()
tilers.append(Layout(IntTuple(2, 2), IntTuple(1, 2)))
var result = apply_tiler[logical_divide](base^, tilers)

Parameters:

  • โ€‹func (def(var Layout, var Layout) thin -> Layout): A function that takes two layouts and returns a transformed layout.

Args:

  • โ€‹layout_a (Layout): The base layout to transform.
  • โ€‹tiler (List[Layout]): A list of layouts to use in the transformation.

Returns:

Layout: A new layout resulting from applying the transformation function to each pair.

Was this page helpful?