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

sum

def sum[dtype: DType, BN: Int, //, *, width: Int = Int(8)](x: TileTensor[dtype, Layout[*?, *?], MutUntrackedOrigin, address_space=AddressSpace.LOCAL]) -> SIMD[dtype, SIMDLength(2)]

Reduces a BN-element local tensor into a width-2 SIMD vector via vectorized accumulation.

Parameters:

  • ​dtype (DType): Element dtype of the input tensor (inferred).
  • ​BN (Int): Number of elements in the input tensor; must be divisible by width (inferred).
  • ​width (Int): Vectorization width for the accumulation (defaults to 8).

Args:

Returns:

SIMD[dtype, SIMDLength(2)]

Was this page helpful?