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 struct

Add

struct Add

Registers the mo.add graph op with the graph compiler.

Implemented traits​

AnyType, ElementwiseBinaryOp, ImplicitlyDeletable

Methods​

elementwise​

static def elementwise[dtype: DType, width: SIMDLength](lhs: SIMD[dtype, width], rhs: SIMD[dtype, width]) -> SIMD[dtype, width]

Returns:

SIMD[dtype, width]

static def elementwise[dtype: DType, LayoutType: TensorLayout](lhs: TileTensor[dtype, LayoutType, MutAnyOrigin], rhs: TileTensor[dtype, LayoutType, MutAnyOrigin]) -> TileTensor[dtype, LayoutType, MutAnyOrigin]

Element-wise add two tiles in place into lhs; see _elementwise_tile.

Parameters:

  • ​dtype (DType): The element type of the operands and the returned tile.
  • ​LayoutType (TensorLayout): The static memory layout shared by both tiles.

Args:

Returns:

TileTensor[dtype, LayoutType, MutAnyOrigin]