Dequantize


tensorflow C++ API

tensorflow::ops::Dequantize

Dequantize the 'input' tensor into a float Tensor.


Summary

[min_range, max_range] are scalar floats that specify the range for the 'input' data. The 'mode' attribute controls exactly which calculations are used to convert the float values to their quantized equivalents.

In 'MIN_COMBINED' mode, each value of the tensor will undergo the following:

``` if T == qint8, in[i] += (range(T) + 1)/ 2.0 out[i] = min_range + (in[i]* (max_range - min_range) / range(T)) ``hererange(T) = numeric_limits::max() - numeric_limits::min()`

MIN_COMBINED Mode Example

If the input comes from aQuantizedRelu6, the output type is quint8 (range of 0-255) but the possible range ofQuantizedRelu6is 0-6. The min_range and max_range values are therefore 0.0 and 6.0.Dequantizeon quint8 will take each value, cast to float, and multiply by 6 / 255. Note that if quantizedtype is qint8, the operation will additionally add each value by 128 prior to casting.

If the mode is 'MIN_FIRST', then this approach is used:

```c++ number_of_steps = 1 << (# of bits in T) range_adjust = number_of_steps / (number_of_steps - 1) range = (range_max - range_min) * range_adjust range_scale = range / number_of_steps const double offset_input = static_cast(input) - lowest_quantized; result = range_min + ((input - numeric_limits::min()) * range_scale) ```

Arguments:

  • scope: A Scope object
  • min_range: The minimum scalar value possibly produced for the input.
  • max_range: The maximum scalar value possibly produced for the input.

Returns:


Dequantize block

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

Argument:

  • Scope scope : A Scope object (A scope is generated automatically each page. A scope is not connected.)
  • Input input: A Tensor . Must be one of the following types: qint8 , quint8 , qint16 , quint16 , qint32 .
  • Input min_range : A Tensor of type float32 . The minimum scalar value possibly produced for the input.
  • Input max_range : A Tensor of type float32 . The maximum scalar value possibly produced for the input.
  • Attr attrs : An optional StringPiece mode from: "MIN_COMBINED", "MIN_FIRST" . Defaults to "MIN_COMBINED" .

Return:

  • Output output : Output object of Dequantize class object.

Result:

  • std::vector(Tensor) result_output :

Using Method

※ tensorflow 1.3 does not support Windows

results matching ""

    No results matching ""