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 struct
ComposedLayout
struct ComposedLayout[layout_t: TensorLayout, layout_a: layout_t, offset: Optional[Int] = Int(0)]
Layout composed of a Layout and a Swizzle applied sequentially.
Combines a base layout with a swizzle. The output of the layout is input to the swizzle, with an optional offset in between.
Parameters
- layout_t (
TensorLayout): Type of the base layout. - layout_a (
layout_t): The base layout the swizzle is applied to. - offset (
Optional[Int]): Optional offset between layouts (default: 0).
Fields
- layout_b (
Swizzle): The swizzle to apply.
Implemented traits
AnyType,
Copyable,
Deinitable,
Movable
Methods
__init__
def __init__(out self, layout_b: Swizzle)
Initialize ComposedLayout with a swizzle.
Args:
- layout_b (
Swizzle): The swizzle.
__call__
def __call__[element_types: TypeList[element_types.values], //](self, idx: Coord[*element_types]) -> Int
Apply composed layout to a Coord index.
Parameters:
- element_types (
TypeList[values]): The element types of the coordinate.
Args:
- idx (
Coord[*element_types]): The coordinate to transform.
Returns:
Int: The transformed index.
size
def size(self) -> Int
Get the size of the composed layout.
Returns the size of the base layout.
Returns:
Int: The size of the base layout.
cosize
def cosize(self) -> Int
Get the cosize of the composed layout.
Returns the cosize of the swizzle.
Returns:
Int: The cosize of the swizzle.