IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/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. /max/get-started.md).

Mojo function

apply_epilogue

def apply_epilogue[elementwise_lambda: def[dtype: DType, width: SIMDLength, *, alignment: Int = Int(1)](IndexList[Int(2)], SIMD[dtype, width]) capturing thin -> None, dst_layout: Layout, dst_element_layout: Layout = Layout(IntTuple(Int(1)), IntTuple(Int(1)))](src: LayoutTensor[address_space=src.address_space, element_layout=src.element_layout, layout_int_type=src.layout_int_type, linear_idx_type=src.linear_idx_type, masked=src.masked, alignment=src.alignment], offset: Int)

Applies an elementwise epilogue lambda to a source tile.

Walks the elements of src and invokes elementwise_lambda with each element's (m, n) coordinate and value, handling both 2D SIMD tiles and the scalar/1D case.

Parameters:

  • ​elementwise_lambda (def[dtype: DType, width: SIMDLength, *, alignment: Int = Int(1)](IndexList[Int(2)], SIMD[dtype, width]) capturing thin -> None): The epilogue lambda to apply per element.
  • ​dst_layout (Layout): The layout of the destination tensor.
  • ​dst_element_layout (Layout): The element layout of the destination tensor.

Args: