scipp.sum

scipp.sum(x, dim=None, *, out=None)

Element-wise sum over the specified dimension.

Parameters
  • x (VariableLike) – Input data.

  • dim (Optional[str]) – Optional dimension along which to calculate the sum. If not given, the sum over all dimensions is calculated.

  • out (Optional[VariableLike]) – Optional output buffer.

Raises

If the dimension does not exist, or the dtype cannot be summed, e.g., if it is a string.

Returns

The sum of the input values.

Seealso

scipp.nansum().

Return type

VariableLike