iVS3D v2.0.0
Loading...
Searching...
No Matches
NN::ReduceSum Struct Reference

Reduces a Tensor by summing its elements along a specified axis. More...

#include <ReduceOps.h>

Detailed Description

Reduces a Tensor by summing its elements along a specified axis.

This operation initializes an accumulator to zero and adds each element along the specified axis.

Tensor tensor = ...; // some tensor
auto result = tensor.reduce(ReduceSum{}, 1); // reduce along axis 1
if (result) {
std::cout << "Reduced Tensor: " << result.value().toString() << std::endl;
} else {
std::cerr << "Error: " << result.error() << std::endl;
}
A Tensor represents a N-dimensional array containing elements of the same type. Can be used as input ...
Definition Tensor.h:201
tl::expected< Tensor, NeuralError > reduce(const Op &op, uint64_t axis) const
Reduce the Tensor along a given axis by applying an accumulative operation.
Definition Tensor.h:483
Reduces a Tensor by summing its elements along a specified axis.
Definition ReduceOps.h:37
See also
Tensor::reduce For the main reduction function that applies this operation.
reduce.cpp For an example of using this operation.

The documentation for this struct was generated from the following file: