dequantize.rst 2.68 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
.. dequantize.rst: 

##########
Dequantize
##########

.. code-block:: cpp

   Dequantize // Maps quantized input to real output

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

14
Produces a tensor of element type ``type`` and the same shape as ``input`` 
15
where the value of each coordinate :math:`i` of ``output`` is the corresponding coordinate of 
16 17 18
``input`` minus ``offset`` quantity multiplied by ``scale``.
The coordinate :math:`j` of ``scale`` and ``offset`` is the coordinate of ``output`` 
projected onto ``axes``.
19 20 21 22

Inputs
------

23 24 25 26 27 28 29 30 31
+-----------------+-------------------------+------------------------------------------+
| Name            | Element Type            | Shape                                    |
+=================+=========================+==========================================+
| ``input``       | Any quantized type      | Any                                      |
+-----------------+-------------------------+------------------------------------------+
| ``scale``       | Same as ``output``      | ``input`` shape projected onto ``axes``  |
+-----------------+-------------------------+------------------------------------------+
| ``offset``      | Same as ``input``       | ``input`` shape projected onto ``axes``  |
+-----------------+-------------------------+------------------------------------------+
32 33 34 35 36 37 38

Attributes
----------

+-------------------------------+----------------------------------------------------------------+
| Name                          | Description                                                    |
+===============================+================================================================+
39
| ``type``                      | ``output`` element type; any real type                         |
40 41 42 43 44 45
+-------------------------------+----------------------------------------------------------------+
| ``axes``                      | Axis positions on which ``scale`` and ``offset`` are specified |
+-------------------------------+----------------------------------------------------------------+



46 47


48 49 50 51 52 53
Outputs
-------

+-----------------+-------------------------+---------------------------------------+
| Name            | Element Type            | Shape                                 |
+=================+=========================+=======================================+
54
| ``output``      | ``type``                | Same as ``input``                     |
55 56 57 58 59 60 61
+-----------------+-------------------------+---------------------------------------+

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

.. math::

62
   \mathtt{output}_{i,j} = (\mathtt{input}_{i,j} - \mathtt{offset}_{j}) \mathtt{scale}_{j}
63 64 65 66 67 68 69

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

.. doxygenclass:: ngraph::op::Dequantize
   :project: ngraph
   :members: