Class ov::op::v1::ReduceSum#

class ReduceSum : public ov::op::util::ArithmeticReductionKeepDims#

Tensor sum operation.

Element-wise sums the input tensor, eliminating the specified reduction axes. For example:

\[\begin{split} \mathit{sum}\left(\{0\}, \left[ \begin{array}{ccc} 1 & 2 \\ 3 & 4 \\ 5 & 6 \end{array} \right]\right) = \left[ (1 + 3 + 5), (2 + 4 + 6) \right] = \left[ 9, 12 \right]~~~\text{(dimension 0 (rows) is eliminated)} \end{split}\]

\[\begin{split} \mathit{sum}\left(\{1\}, \left[ \begin{array}{ccc} 1 & 2 \\ 3 & 4 \\ 5 & 6 \end{array} \right]\right) = \left[ (1 + 2), (3 + 4), (5 + 6) \right] = \left[ 3, 7, 11 \right]~~~\text{(dimension 1 (columns) is eliminated)} \end{split}\]

\[\begin{split} \mathit{sum}\left(\{0,1\}, \left[ \begin{array}{ccc} 1 & 2 \\ 3 & 4 \\ 5 & 6 \end{array} \right]\right) = (1 + 2) + (3 + 4) + (5 + 6) = 21~~~\text{(both dimensions (rows and columns) are eliminated)} \end{split}\]

Parameters

Description

reduction_axes

The axes to eliminate through summation.

keep_dims

If set to 1 it holds axes that are used for reduction.

Inputs

Type

Description

arg

\(N[d_1,\dots,d_n]~(n \geq 0)\)

An input tensor of any shape and numeric element type.

Type

Description

\(N[\textit{delete}(A,d_1,\dots,d_n)]\)

The tensor \(T\), where \(T\) is the input tensor with the reduction_axes \(A\) eliminated by summation.

Public Functions

ReduceSum() = default#

Constructs a summation operation.

ReduceSum(const Output<Node> &arg, const Output<Node> &reduction_axes, bool keep_dims = false)#

Constructs a summation operation.

Parameters:
  • arg – The tensor to be summed.

  • reduction_axes – The axis positions (0-based) to be eliminated.

  • keep_dims – If set to 1 it holds axes that are used for reduction.

virtual bool has_evaluate() const override#

Allows to get information about availability of evaluate method for the current operation.