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

Loadable

LoadAccess refined with the callable load method.

Implemented traits​

AnyType, LoadAccess, Tensor

comptime members​

dtype​

comptime dtype

rank​

comptime rank

ShapeType​

comptime ShapeType

Required methods​

load​

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

Loads a SIMD vector of elements at idx.

Parameters:

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

Args:

  • ​idx (Coord): The element coordinate to load from.

Returns:

SIMD[_Self.dtype, width]: The loaded SIMD[Self.dtype, width] value.

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?