product.rst 2.41 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
.. product.rst:

#######
Product
#######

.. code-block:: cpp

   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
=======================

.. math::

   \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}


C++ Interface
=============

73
.. doxygenclass:: ngraph::op::v0::Product
74 75
   :project: ngraph
   :members: