Commit 7e394ac6 authored by Adam Straw's avatar Adam Straw Committed by Scott Cyphers

Quantized and Dequantize doc fixes (#1850)

* fixing some quantize and dequantize doc issues

* Update doc/sphinx/source/ops/dequantize.rst

* Update doc/sphinx/source/ops/dequantize.rst

* Update doc/sphinx/source/ops/dequantize.rst

* Update doc/sphinx/source/ops/quantize.rst

* Update doc/sphinx/source/ops/quantize.rst

* Update doc/sphinx/source/ops/quantize.rst

* change output to hypertext

* style check
parent de462cba
......@@ -11,23 +11,24 @@ Dequantize
Description
===========
Produces a tensor of element type ``type`` and the same shape as ``input``
Produces a tensor of element type ``type`` and the same shape as ``input``
where the value of each coordinate :math:`i` of ``output`` is the corresponding coordinate of
``input`` plus ``offset`` quantity multiplied by ``scale``. The coordinate :math:`j` of
``scale`` and ``offset`` is the coordinate of ``output`` projected onto ``axes``.
``input`` minus ``offset`` quantity multiplied by ``scale``.
The coordinate :math:`j` of ``scale`` and ``offset`` is the coordinate of ``output``
projected onto ``axes``.
Inputs
------
+-----------------+-------------------------+---------------------------------------+
| Name | Element Type | Shape |
+=================+=========================+=======================================+
| ``input`` | Any quantized type | Any |
+-----------------+-------------------------+---------------------------------------+
| ``scale`` | Same as ``output`` | ``input`` shape projected on ``axes`` |
+-----------------+-------------------------+---------------------------------------+
| ``offset`` | Same as ``input`` | ``input`` shape projected on ``axes`` |
+-----------------+-------------------------+---------------------------------------+
+-----------------+-------------------------+------------------------------------------+
| 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`` |
+-----------------+-------------------------+------------------------------------------+
Attributes
----------
......@@ -35,20 +36,22 @@ Attributes
+-------------------------------+----------------------------------------------------------------+
| Name | Description |
+===============================+================================================================+
| ``type`` | ``output`` element type |
| ``type`` | ``output`` element type; any real type |
+-------------------------------+----------------------------------------------------------------+
| ``axes`` | Axis positions on which ``scale`` and ``offset`` are specified |
+-------------------------------+----------------------------------------------------------------+
Outputs
-------
+-----------------+-------------------------+---------------------------------------+
| Name | Element Type | Shape |
+=================+=========================+=======================================+
| ``output`` | is_real() | Same as ``input`` |
| ``output`` | ``type`` | Same as ``input`` |
+-----------------+-------------------------+---------------------------------------+
Mathematical Definition
......@@ -56,8 +59,7 @@ Mathematical Definition
.. math::
\mathtt{output}_{i} = (\mathtt{input}_{i} + \mathtt{offset}_{j}) \mathtt{scale}_{j}
\mathtt{output}_{i,j} = (\mathtt{input}_{i,j} - \mathtt{offset}_{j}) \mathtt{scale}_{j}
C++ Interface
=============
......
......@@ -11,24 +11,24 @@ Quantize
Description
===========
Produces a tensor of element type ``type`` and the same shape as ``input``
where the value of each coordinate :math:`i` of ``output`` is the corresponding
coordinate of ``input`` divided by ``scale`` rounded as specified by
``round_mode`` minus ``offset``. The coordinate :math:`j` of ``scale`` and
``offset`` is the coordinate of ``output`` projected onto ``axes``.
Produces a tensor of element type ``type`` and the same shape as ``input``
where the value of each coordinate :math:`i` of ``output`` is the corresponding coordinate of
``input`` divided by ``scale`` rounded as specified by ``round_mode`` plus ``offset``.
The coordinate :math:`j` of ``scale`` and ``offset`` is the coordinate of ``output``
projected onto ``axes``.
Inputs
------
+-----------------+-------------------------+---------------------------------------+
| Name | Element Type | Shape |
+=================+=========================+=======================================+
| ``input`` | is_real() | Any |
+-----------------+-------------------------+---------------------------------------+
| ``scale`` | Same as ``input`` | ``input`` shape projected on ``axes`` |
+-----------------+-------------------------+---------------------------------------+
| ``offset`` | Same as ``output`` | ``input`` shape projected on ``axes`` |
+-----------------+-------------------------+---------------------------------------+
+-----------------+-------------------------+------------------------------------------+
| Name | Element Type | Shape |
+=================+=========================+==========================================+
| ``input`` | Any real type | Any |
+-----------------+-------------------------+------------------------------------------+
| ``scale`` | Same as ``input`` | ``input`` shape projected onto ``axes`` |
+-----------------+-------------------------+------------------------------------------+
| ``offset`` | Same as ``output`` | ``input`` shape projected onto ``axes`` |
+-----------------+-------------------------+------------------------------------------+
Attributes
----------
......@@ -36,7 +36,7 @@ Attributes
+-------------------------------+----------------------------------------------------------------+
| Name | Description |
+===============================+================================================================+
| ``type`` | The output element type, which must be a quantized type |
| ``type`` | ``output`` element type; any quantized type |
+-------------------------------+----------------------------------------------------------------+
| ``axes`` | Axis positions on which ``scale`` and ``offset`` are specified |
+-------------------------------+----------------------------------------------------------------+
......@@ -51,7 +51,7 @@ Outputs
+-----------------+-------------------------+---------------------------------------+
| Name | Element Type | Shape |
+=================+=========================+=======================================+
| ``output`` | type | Same as ``input`` |
| ``output`` | ``type`` | Same as ``input`` |
+-----------------+-------------------------+---------------------------------------+
Mathematical Definition
......@@ -59,9 +59,7 @@ Mathematical Definition
.. math::
\mathtt{output}_{i} = \mathtt{round}(\frac{\mathtt{input}_{i}}{\mathtt{scale}_{j}}) - \mathtt{offset}_{j}
\mathtt{output}_{i,j} = \mathtt{round}\left(\frac{\mathtt{input}_{i,j}}{\mathtt{scale}_{j}}\right) + \mathtt{offset}_{j}
C++ Interface
=============
......
......@@ -25,15 +25,15 @@ namespace ngraph
namespace op
{
/// \brief Dequantize operation
/// Maps quantized input (q) to real output (r) using scale (s) and offset (o)
/// q = (r + o) * s
/// Maps quantized input (q) to real output (r) using scale (s) and offset (o):
/// r = (q - o) * s
class Dequantize : public ngraph::op::Op
{
public:
/// \brief Constructs a Dequantize operation
/// \param input quantized input
/// \param scale element type: same as `type`, shape: input shape projected along `axes`
/// \param offset element type: same as `input`, shape: input shape projected along `axes`
/// \param scale scale used for mapping
/// \param offset offset used for mapping
/// \param type output element type
/// \param axes axis positions on which `scale` and `offset` are specified
Dequantize(std::shared_ptr<Node> input,
......
......@@ -25,8 +25,8 @@ namespace ngraph
namespace op
{
/// \brief Quantize operation
/// Maps real input (r) to quantized output (q) using scale (s), offset (o) and round mode
/// q = ROUND(r / s) - o
/// Maps real input (r) to quantized output (q) using scale (s), offset (o) and round mode:
/// q = ROUND(r / s) + o
class Quantize : public ngraph::op::Op
{
public:
......@@ -42,8 +42,8 @@ namespace ngraph
/// \brief Constructs a Quantize operation
/// \param input real input
/// \param scale element type: same as `input`, shape: `input` shape projected along `axes`
/// \param offset element type: same as `type`, shape: `input` shape projected along `axes`
/// \param scale scale used for mapping
/// \param offset offset used for mapping
/// \param type output element type
/// \param axes axis positions on which `scale` and `offset` are specified
/// \param round_mode describes how to perform ROUND function
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment