public sum(axis as Long, keepDims as Boolean = false, where as Boolean[] = null, ignoreNaN as Boolean = false, result as NDArray<T> = null) as NDArray<T>
Computes the sum along one axis.
a = NDArray<Int>([[1, 2], [3, 4]]) print(a.sum(0)) # [4, 6] print(a.sum(1)) # [3, 7]
| Parameter | Description |
|---|---|
keepDims | Retain reduced dimensions with length one. |
result | Optional non-aliased destination of the exact output shape. |
where | Optional flat Boolean selection mask. |
ignoreNaN | Skip NaNs; otherwise preserve this operation's default NaN contract. |