Class ov::op::util::BinaryElementwiseArithmetic

class BinaryElementwiseArithmetic : public ov::op::Op

Abstract base class for elementwise binary arithmetic operations, i.e., operations where the same scalar binary arithmetic operation is applied to each corresponding pair of elements in the two input tensors. Implicit broadcast of input tensors is supported through one of the AutoBroadcast modes.

For example, if the underlying arithmetic operation (determined by the subclass) is \(\mathit{op}(x,y)\), the input tensors \([[x_0,y_0],[z_0,w_0]]\) and \([[x_1,y_1],[z_1,w_1]]\) will be mapped to \([[\mathit{op}(x_0,x_1),\mathit{op}(y_0,y_1)],[\mathit{op}(z_0,z_1),\mathit{op}(w_0,w_1)]]\).

Inputs

Type

Description

arg0

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

A tensor of any shape. The element type \(N\) may be any numeric type.

arg1

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

A tensor of the same element type as arg0.

autob

AutoBroadcastSpec

Auto broadcast specification.

Type

Description

\(N[d_1,\dots,d_n]\)

The tensor \(T\), where \(T[i_1,\dots,i_n] = \mathit{op}(\texttt{arg0}[i_1,\dots,i_n],\texttt{arg1}[i_1,\dots,i_n])\). This will always have the same shape and element type as the input tensors (after auto broadcasting).

Subclassed by ov::op::v0::SquaredDifference, ov::op::v1::Add, ov::op::v1::Divide, ov::op::v1::FloorMod, ov::op::v1::Maximum, ov::op::v1::Minimum, ov::op::v1::Mod, ov::op::v1::Multiply, ov::op::v1::Power, ov::op::v1::Subtract

Public Functions

virtual void validate_and_infer_types() override

Verifies that attributes and inputs are consistent and computes output shapes and element types. Must be implemented by concrete child classes so that it can be run any number of times.

Throws if the node is invalid.

inline virtual const AutoBroadcastSpec &get_autob() const override
Returns

the autobroadcasr spec