Link Search Menu Expand Document

Requantize


tensorflow C++ API

tensorflow::ops::Requantize

Convert the quantized ‘input’ tensor into a lower-precision ‘output’, using the output range specified with ‘requested_output_min’ and ‘requested_output_max’.


Summary

[input_min, input_max] are scalar floats that specify the range for the float interpretation of the ‘input’ data. For example, if input_min is -1.0f and input_max is 1.0f, and we are dealing with quint16 quantized data, then a 0 value in the 16-bit data should be interpreted as -1.0f, and a 65535 means 1.0f.

Arguments:

  • scope: A Scope object
  • input_min: The float value that the minimum quantized input value represents.
  • input_max: The float value that the maximum quantized input value represents.
  • requested_output_min: The float value that the minimum quantized output value represents.
  • requested_output_max: The float value that the maximum quantized output value represents.
  • out_type: The type of the output. Should be a lower bit depth than Tinput.

Output

  • Output output
  • Output output_min: The computed min output.
  • Output output_max: The computed max output.

Constructor

  • QuantizeDownAndShrinkRange(const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input input_min, ::tensorflow::Input input_max, DataType out_type)

Public attributes

  • tensorflow::Output output.
  • tensorflow::Output output_min.
  • tensorflow::Output output_max.

Requantize block

Source link : https://github.com/EXPNUNI/enuSpaceTensorflow/blob/master/enuSpaceTensorflow/tf_math.cpp

Argument:

  • Scope scope : A Scope object (A scope is generated automatically each page. A scope is not connected.).
  • Input input : connect Input node.
  • Input input_min : connect Input node.
  • Input input_max : connect Input node.
  • Input requested_output_min : connect Input node.
  • Input requested_output_max : connect Input node.
  • DataType out_type : input DataType. ex)DT__QINT8

Return:

  • Output output: Output object of Requantize class object.

Result:

  • std::vector(Tensor) product_result : Returned object of executed result by calling session.

Using Method

tensorflow -> error: No OpKernel was registered to support Op ‘Requantize’ with these attrs. Registered devices: [CPU,GPU], Registered kernels:

<no registered kernels>

[[Node: Requantize = Requantize[Tinput=DT_QINT16,out_type=DT_QINT8](Cast, Const_2, Const_4, Const_2, Const_4)]].