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 ...@@ -11,23 +11,24 @@ Dequantize
Description 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 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 ``input`` minus ``offset`` quantity multiplied by ``scale``.
``scale`` and ``offset`` is the coordinate of ``output`` projected onto ``axes``. The coordinate :math:`j` of ``scale`` and ``offset`` is the coordinate of ``output``
projected onto ``axes``.
Inputs Inputs
------ ------
+-----------------+-------------------------+---------------------------------------+ +-----------------+-------------------------+------------------------------------------+
| Name | Element Type | Shape | | Name | Element Type | Shape |
+=================+=========================+=======================================+ +=================+=========================+==========================================+
| ``input`` | Any quantized type | Any | | ``input`` | Any quantized type | Any |
+-----------------+-------------------------+---------------------------------------+ +-----------------+-------------------------+------------------------------------------+
| ``scale`` | Same as ``output`` | ``input`` shape projected on ``axes`` | | ``scale`` | Same as ``output`` | ``input`` shape projected onto ``axes`` |
+-----------------+-------------------------+---------------------------------------+ +-----------------+-------------------------+------------------------------------------+
| ``offset`` | Same as ``input`` | ``input`` shape projected on ``axes`` | | ``offset`` | Same as ``input`` | ``input`` shape projected onto ``axes`` |
+-----------------+-------------------------+---------------------------------------+ +-----------------+-------------------------+------------------------------------------+
Attributes Attributes
---------- ----------
...@@ -35,20 +36,22 @@ Attributes ...@@ -35,20 +36,22 @@ Attributes
+-------------------------------+----------------------------------------------------------------+ +-------------------------------+----------------------------------------------------------------+
| Name | Description | | Name | Description |
+===============================+================================================================+ +===============================+================================================================+
| ``type`` | ``output`` element type | | ``type`` | ``output`` element type; any real type |
+-------------------------------+----------------------------------------------------------------+ +-------------------------------+----------------------------------------------------------------+
| ``axes`` | Axis positions on which ``scale`` and ``offset`` are specified | | ``axes`` | Axis positions on which ``scale`` and ``offset`` are specified |
+-------------------------------+----------------------------------------------------------------+ +-------------------------------+----------------------------------------------------------------+
Outputs Outputs
------- -------
+-----------------+-------------------------+---------------------------------------+ +-----------------+-------------------------+---------------------------------------+
| Name | Element Type | Shape | | Name | Element Type | Shape |
+=================+=========================+=======================================+ +=================+=========================+=======================================+
| ``output`` | is_real() | Same as ``input`` | | ``output`` | ``type`` | Same as ``input`` |
+-----------------+-------------------------+---------------------------------------+ +-----------------+-------------------------+---------------------------------------+
Mathematical Definition Mathematical Definition
...@@ -56,8 +59,7 @@ Mathematical Definition ...@@ -56,8 +59,7 @@ Mathematical Definition
.. math:: .. 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 C++ Interface
============= =============
......
...@@ -11,24 +11,24 @@ Quantize ...@@ -11,24 +11,24 @@ Quantize
Description 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 where the value of each coordinate :math:`i` of ``output`` is the corresponding coordinate of
coordinate of ``input`` divided by ``scale`` rounded as specified by ``input`` divided by ``scale`` rounded as specified by ``round_mode`` plus ``offset``.
``round_mode`` minus ``offset``. The coordinate :math:`j` of ``scale`` and The coordinate :math:`j` of ``scale`` and ``offset`` is the coordinate of ``output``
``offset`` is the coordinate of ``output`` projected onto ``axes``. projected onto ``axes``.
Inputs Inputs
------ ------
+-----------------+-------------------------+---------------------------------------+ +-----------------+-------------------------+------------------------------------------+
| Name | Element Type | Shape | | Name | Element Type | Shape |
+=================+=========================+=======================================+ +=================+=========================+==========================================+
| ``input`` | is_real() | Any | | ``input`` | Any real type | Any |
+-----------------+-------------------------+---------------------------------------+ +-----------------+-------------------------+------------------------------------------+
| ``scale`` | Same as ``input`` | ``input`` shape projected on ``axes`` | | ``scale`` | Same as ``input`` | ``input`` shape projected onto ``axes`` |
+-----------------+-------------------------+---------------------------------------+ +-----------------+-------------------------+------------------------------------------+
| ``offset`` | Same as ``output`` | ``input`` shape projected on ``axes`` | | ``offset`` | Same as ``output`` | ``input`` shape projected onto ``axes`` |
+-----------------+-------------------------+---------------------------------------+ +-----------------+-------------------------+------------------------------------------+
Attributes Attributes
---------- ----------
...@@ -36,7 +36,7 @@ Attributes ...@@ -36,7 +36,7 @@ Attributes
+-------------------------------+----------------------------------------------------------------+ +-------------------------------+----------------------------------------------------------------+
| Name | Description | | 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 | | ``axes`` | Axis positions on which ``scale`` and ``offset`` are specified |
+-------------------------------+----------------------------------------------------------------+ +-------------------------------+----------------------------------------------------------------+
...@@ -51,7 +51,7 @@ Outputs ...@@ -51,7 +51,7 @@ Outputs
+-----------------+-------------------------+---------------------------------------+ +-----------------+-------------------------+---------------------------------------+
| Name | Element Type | Shape | | Name | Element Type | Shape |
+=================+=========================+=======================================+ +=================+=========================+=======================================+
| ``output`` | type | Same as ``input`` | | ``output`` | ``type`` | Same as ``input`` |
+-----------------+-------------------------+---------------------------------------+ +-----------------+-------------------------+---------------------------------------+
Mathematical Definition Mathematical Definition
...@@ -59,9 +59,7 @@ Mathematical Definition ...@@ -59,9 +59,7 @@ Mathematical Definition
.. math:: .. 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 C++ Interface
============= =============
......
...@@ -25,15 +25,15 @@ namespace ngraph ...@@ -25,15 +25,15 @@ namespace ngraph
namespace op namespace op
{ {
/// \brief Dequantize operation /// \brief Dequantize operation
/// Maps quantized input (q) to real output (r) using scale (s) and offset (o) /// Maps quantized input (q) to real output (r) using scale (s) and offset (o):
/// q = (r + o) * s /// r = (q - o) * s
class Dequantize : public ngraph::op::Op class Dequantize : public ngraph::op::Op
{ {
public: public:
/// \brief Constructs a Dequantize operation /// \brief Constructs a Dequantize operation
/// \param input quantized input /// \param input quantized input
/// \param scale element type: same as `type`, shape: input shape projected along `axes` /// \param scale scale used for mapping
/// \param offset element type: same as `input`, shape: input shape projected along `axes` /// \param offset offset used for mapping
/// \param type output element type /// \param type output element type
/// \param axes axis positions on which `scale` and `offset` are specified /// \param axes axis positions on which `scale` and `offset` are specified
Dequantize(std::shared_ptr<Node> input, Dequantize(std::shared_ptr<Node> input,
......
...@@ -25,8 +25,8 @@ namespace ngraph ...@@ -25,8 +25,8 @@ namespace ngraph
namespace op namespace op
{ {
/// \brief Quantize operation /// \brief Quantize operation
/// Maps real input (r) to quantized output (q) using scale (s), offset (o) and round mode /// Maps real input (r) to quantized output (q) using scale (s), offset (o) and round mode:
/// q = ROUND(r / s) - o /// q = ROUND(r / s) + o
class Quantize : public ngraph::op::Op class Quantize : public ngraph::op::Op
{ {
public: public:
...@@ -42,8 +42,8 @@ namespace ngraph ...@@ -42,8 +42,8 @@ namespace ngraph
/// \brief Constructs a Quantize operation /// \brief Constructs a Quantize operation
/// \param input real input /// \param input real input
/// \param scale element type: same as `input`, shape: `input` shape projected along `axes` /// \param scale scale used for mapping
/// \param offset element type: same as `type`, shape: `input` shape projected along `axes` /// \param offset offset used for mapping
/// \param type output element type /// \param type output element type
/// \param axes axis positions on which `scale` and `offset` are specified /// \param axes axis positions on which `scale` and `offset` are specified
/// \param round_mode describes how to perform ROUND function /// \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