warp.utils.array_sum#

warp.utils.array_sum(values, out=None, value_count=None, axis=None)[source]#

Compute the sum of array elements.

This function computes the sum of array elements, optionally along a specified axis. The operation can be performed on the entire array or along a specific dimension.

Parameters:
  • values (array) – Input array to sum. Must be of type float32 or float64.

  • out (array | None) – Output array to store results. If None, a new array is created.

  • value_count (int | None) – Number of elements to process. If None, processes entire array.

  • axis (int | None) – Axis along which to compute sum. If None, computes sum of all elements.

Returns:

The sum result. Returns a float if axis is None and out is None, otherwise returns the out array.

Raises:

RuntimeError – If output array storage device or data type is incompatible with input array.

Return type:

array | float