Subtract  // Elementwise subtract operation


Elementwise subtract operation.

Produces tensor of the same element type and shape as the two inputs, where the value at each coordinate of output is the difference of the values at the corresponding input coordinates.


Name Element Type Shape
arg0 any any
arg1 same as arg0 same as arg0


Name Element Type Shape
output same as arg0 same as arg0

Mathematical Definition

\[\mathtt{output}_{i_0, \ldots, i_{n-1}} = \mathtt{arg0}_{i_0, \ldots, i_{n-1}} - \mathtt{arg1}_{i_0, \ldots, i_{n-1}}\]


\[\begin{split}\overline{\mathtt{arg0}} &\leftarrow \Delta \\ \overline{\mathtt{arg1}} &\leftarrow -\Delta\end{split}\]

C++ Interface

class Subtract : public ngraph::op::util::BinaryElementwiseArithmetic

Elementwise subtraction operation.

Public Functions

const std::string &description() const

Get the string name for the type of the node, such as Add or Multiply. The class name, must not contain spaces as it is used for codegen.

A const reference to the node’s type name

Subtract(const Output<Node> &arg0, const Output<Node> &arg1, const AutoBroadcastSpec &autob = AutoBroadcastSpec())

Constructs an subtraction operation.

  • arg0: Node that produces the first input tensor.
  • arg1: Node that produces the second input tensor.
  • autob: Auto broadcast specification