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).
apply_tiler
apply_tiler[func: def(var Layout, var Layout) -> 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) -> 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.