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

coalesce

def coalesce[l: Layout, keep_rank: Bool = False](layout: RuntimeLayout[l, element_type=layout.element_type, linear_idx_type=layout.linear_idx_type]) -> RuntimeLayout[coalesce(l, keep_rank), element_type=layout.element_type, linear_idx_type=layout.linear_idx_type]

Coalesce adjacent dimensions in a runtime layout when possible.

This optimizes the layout by merging adjacent dimensions when their relationship allows it, potentially reducing the number of dimensions.

Parameters:

  • โ€‹l (Layout): The static layout type to coalesce.
  • โ€‹keep_rank (Bool): Whether to maintain the original rank (currently unsupported).

Args:

Returns:

RuntimeLayout[coalesce(l, keep_rank), element_type=layout.element_type, linear_idx_type=layout.linear_idx_type]: A new RuntimeLayout with coalesced dimensions.

Was this page helpful?