Product

Product // Product reduction operation.

Description

Reduces the tensor, eliminating the specified reduction axes by taking the product.

Inputs

Name Element Type Shape
arg Any Any

Attributes

Name Description
reduction_axes The axis positions (0-based) on which to calculate the product

Outputs

Name Element Type Shape
output Same as arg Same as arg, with reduction_axes removed.

Mathematical Definition

\[\begin{split}\mathit{product}\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[ 15, 48 \right]&\text{ dimension 0 (rows) is eliminated} \\ \mathit{product}\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[ 2, 12, 30 \right]&\text{ dimension 1 (columns) is eliminated}\\ \mathit{product}\left(\{0,1\}, \left[ \begin{array}{ccc} 1 & 2 \\ 3 & 4 \\ 5 & 6 \end{array} \right]\right) &= (1 * 2) * (3 * 4) * (5 * 6) = 720&\text{ both dimensions (rows and columns) are eliminated}\end{split}\]

C++ Interface

class Product : public ngraph::op::util::ArithmeticReduction

Product reduction operation.

Reduces the tensor, eliminating the specified reduction axes by taking the product.

Public Functions

const NodeTypeInfo &get_type_info() const

Returns the NodeTypeInfo for the node’s class. During transition to type_info, returns a dummy type_info for Node if the class has not been updated yet.

Product()

Constructs a product reduction operation.

Product(const Output<Node> &arg, const AxisSet &reduction_axes)

Constructs a product reduction operation.

Parameters
  • arg: The tensor to be reduced.
  • reduction_axes: The axis positions (0-based) to be eliminated.

Product(const Output<Node> &arg, const Output<Node> &reduction_axes)

Constructs a product reduction operation.

Parameters
  • arg: The tensor to be reduced.
  • reduction_axes: The axis positions (0-based) to be eliminated.

shared_ptr<Node> get_default_value() const

Return
The default value for Product.