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 trait

Transformable

TransformAccess refined with the callable transform method.

Implemented traits​

AnyType, Tensor, TransformAccess

comptime members​

dtype​

comptime dtype

rank​

comptime rank

ShapeType​

comptime ShapeType

Required methods​

transform​

def transform[width: Int, element_alignment: Int = Int(1)](self, idx: Coord, value: SIMD[Self.dtype, width]) -> SIMD[Self.dtype, width]

Applies the fused transform to a computed value at idx.

Parameters:

  • ​width (Int): Number of elements in the value.
  • ​element_alignment (Int): Assumed alignment in elements.

Args:

  • ​idx (Coord): The element coordinate being produced.
  • ​value (SIMD[_Self.dtype, width]): The computed SIMD[Self.dtype, width] value to transform.

Returns:

SIMD[_Self.dtype, width]: The transformed value; the parent kernel performs the final store.

shape​

def shape(self) -> Self.ShapeType

Returns the tensor's runtime shape.

Returns:

_Self.ShapeType: The shape as a Coord of the argument's ShapeType.

Was this page helpful?