Dequantize

Dequantize // Maps quantized input to real output

Description

Produces a tensor of element type type and the same shape as input where the value of each coordinate \(i\) of output is the corresponding coordinate of input minus offset quantity multiplied by scale. The coordinate \(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 onto axes
offset Same as input input shape projected onto axes

Attributes

Name Description
type output element type; any real type
axes Axis positions on which scale and offset are specified

Outputs

Name Element Type Shape
output type Same as input

Mathematical Definition

\[\mathtt{output}_{i,j} = (\mathtt{input}_{i,j} - \mathtt{offset}_{j}) \mathtt{scale}_{j}\]

C++ Interface

class Dequantize : public ngraph::op::Op

Dequantize operation Maps quantized input (q) to real output (r) using scale (s) and offset (o): r = (q - o) * s.

Public Functions

Dequantize(std::shared_ptr<Node> input, std::shared_ptr<Node> scale, std::shared_ptr<Node> offset, const ngraph::element::Type &type, const ngraph::AxisSet &axes)

Constructs a Dequantize operation.

Parameters
  • input: quantized input
  • scale: scale used for mapping
  • offset: offset used for mapping
  • type: output element type
  • axes: axis positions on which scale and offset are specified

void validate_and_infer_types()

Throws if the node is invalid.