dot.rst 2.7 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
.. dot.rst:

###
Dot
###

.. code-block:: cpp

   Dot  //  Generalized dot product operation


Description
===========

Generalized dot product operation, including scalar-tensor product,
matrix-vector product, and matrix multiplication.

A few common cases are as follows:

* If :math:`m = 0` and :math:`n = 1` or :math:`p = 1`, the operation
  is a scalar-tensor product.
* If :math:`m = 1`, :math:`n = 2`, and :math:`p = 1`, the operation is
  a matrix-vector product.
* If :math:`m = 1` and :math:`n = p = 2`, the operation is a matrix
  multiplication.


Inputs
------

+-----------------+-------------------------+-----------------------------------------+
| Name            | Element Type            | Shape                                   |
+=================+=========================+=========================================+
| ``arg0``        | any                     | :math:`(i_1,\dots,i_n,j_1,\dots,j_m)`   |
+-----------------+-------------------------+-----------------------------------------+
| ``arg1``        | same as ``arg0``        | :math:`(j_1,\ldots,j_m,k_1,\dots,k_p)`  |
+-----------------+-------------------------+-----------------------------------------+

Attributes
----------

+------------------------+---------------+--------------------------------------------------+
| Name                   |               |                                                  |
+========================+===============+==================================================+
| reduction_axes_count   | ``size_t``    | The number of axes to reduce through dot-product |
|                        |               | (corresponds to :math:`m` in the formulas above) |
+------------------------+---------------+--------------------------------------------------+

Outputs
-------

+-----------------+-------------------------+----------------------------------------+
| Name            | Element Type            | Shape                                  |
+=================+=========================+========================================+
| ``output``      | same as ``arg0``        | :math:`(i_1,\ldots,i_n,k_1,\dots,k_p)` |
+-----------------+-------------------------+----------------------------------------+


Mathematical Definition
=======================

.. math::

64
   \mathtt{output}_{i_1,\dots,i_n,k_1,\ldots,k_p} =
65
   \begin{cases}
66 67
   \mathtt{arg0}_{i_1,\dots,i_n} \cdot
   \mathtt{arg1}_{k_1,\dots,k_p}&\text{if }m=0,\\
68
   \sum_{j_1, \ldots, j_m}
69
   \mathtt{arg0}_{i_1,\dots,i_n,j_1,\dots,j_m}
70
   \cdot
71
   \mathtt{arg1}_{j_1,\ldots,j_m,k_1,\ldots,k_p}
72 73 74 75 76 77 78 79 80 81 82 83 84
   &\text{otherwise}.
   \end{cases}


Backprop
========

To be documented.


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

85
.. doxygenclass:: ngraph::op::v0::Dot
86 87
   :project: ngraph
   :members: