tensor.reduce_sum
tensor.reduce_sum
fn reduce_sum(self: @Tensor<T>, axes: Option<Span<i32>>, keepdims: Option<bool>, noop_with_empty_axes: Option<bool>) -> Tensor<T>;Args
Returns
Examples
use core::array::{ArrayTrait, SpanTrait};
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};
fn reduce_sum_example() -> Tensor<u32> {
let tensor = TensorTrait::<u32>::new(
shape: array![2, 2, 2].span(), data: array![0, 1, 2, 3, 4, 5, 6, 7].span(),
);
// We can call `reduce_sum` function as follows.
return tensor.reduce_sum(axes: Option::None, keepdims: false);
}
>>> [[4,6],[8,10]]Last updated