Sums array elements along the specified dimensions.
Value
arrayish
Has the same data type as the input.
When drop = TRUE, the shape is that of operand with dims removed.
When drop = FALSE, the shape is that of operand with dims set to 1.
It is ambiguous if the input is ambiguous.
StableHLO
Lowers to stablehlo::hlo_reduce() with stablehlo::hlo_add() as the reducer.
Examples
x <- nv_matrix(1:6, nrow = 2)
prim_reduce_sum(x, dims = 1L)
#> AnvlArray
#> 3
#> 7
#> 11
#> [ CPUi32{3} ]