tensorflow::ops::QuantizeV2
tensorflow::ops::QuantizeV2
#include <array_ops.h>
Quantize the 'input' tensor of type float to 'output' tensor of type 'T'.
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:
``` out[i] = (in[i] - min_range) * range(T) / (max_range - min_range) if T == qint8, out[i] -= (range(T) + 1) / 2.0 `` here
range(T) = numeric_limits
MIN_COMBINED Mode Example
Assume the input is type float and has a possible range of [0.0, 6.0] and the output type is quint8 ([0, 255]). The min_range and max_range values should be specified as 0.0 and 6.0. Quantizing from float to quint8 will multiply each va