Mojo function
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)
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:
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)
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:
A new layout representing the hierarchical division of layout_a according to the patterns in tiler.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!