Mojo function
hierarchical_unzip
hierarchical_unzip(layout_a: Layout, tiler: List[Layout]) -> Layout
Hierarchically unzips a layout according to a list of layouts.
This function creates a hierarchical layout by unzipping the first layout according to the layouts in the tiler list. It's useful for decomposing a layout into hierarchical components for more efficient memory access patterns or to enable specialized tensor operations.
Example:
from layout import Layout, LayoutList, IntTuple
from layout.layout import hierarchical_unzip
# Create a layout to unzip
var base = Layout.row_major(6, 8)
var tilers = LayoutList()
tilers.append(Layout(IntTuple(2, 2)))
var result = hierarchical_unzip(base, tilers)Args:
- βlayout_a (
Layout): The layout to be unzipped. - βtiler (
List): A list of layouts defining the unzipping patterns.
Returns:
Layout: A new layout representing the hierarchical unzipping with components
from both the original layout and the tiler layouts.
hierarchical_unzip(layout_a: Layout, layout_b: Layout) -> Layout
Hierarchically unzips a layout according to another layout.
This function creates a hierarchical layout by unzipping the first layout according to the second layout. It's a fundamental operation for decomposing a layout into hierarchical components, which enables more efficient memory access patterns for various tensor operations.
Example:
from layout import Layout, IntTuple
from layout.layout import hierarchical_unzip
# Create layouts
var base = Layout.row_major(6, 8)
var pattern = Layout(IntTuple(2, 2))
var result = hierarchical_unzip(base, pattern)Args:
- βlayout_a (
Layout): The layout to be unzipped. - βlayout_b (
Layout): The layout defining the unzipping pattern.
Returns:
Layout: A new layout representing the hierarchical unzipping of layout_a
according to the pattern defined by layout_b.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!