Skip to main content

Mojo function

sum

sum(src: Buffer[type, size, address_space]) -> SIMD[$0, 1]

Computes the sum of buffer elements.

Args:

  • src (Buffer[type, size, address_space]): The buffer.

Returns:

The sum of the buffer elements.

sum[reduce_axis: Int](src: NDBuffer[type, rank, shape, strides, address_space], dst: NDBuffer[type, rank, shape, create_unknown[::Int](), 0])

Computes the sum across reduce_axis of an NDBuffer.

Parameters:

  • reduce_axis (Int): The axis to reduce across.

Args:

  • src (NDBuffer[type, rank, shape, strides, address_space]): The input buffer.
  • dst (NDBuffer[type, rank, shape, create_unknown[::Int](), 0]): The output buffer.