dequantize.rst 2.75 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
``input`` minus ``zero_point`` quantity multiplied by ``scale``.
The coordinate :math:`j` of ``scale`` and ``zero_point`` is the coordinate of ``output`` 
18
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``      |
+-----------------+-------------------------+----------------------------------------------+
| ``zero_point``      | Same as ``input``       | ``input`` shape projected onto ``axes``  |
+-----------------+-------------------------+----------------------------------------------+
32 33 34 35

Attributes
----------

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



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{zero_point}_{j}) \mathtt{scale}_{j}
63 64 65 66 67 68 69

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

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