Type tf.quantization
Namespace tensorflow
Public static methods
Tensor quantize_and_dequantize(IGraphNodeBase input, object input_min, object input_max, bool signed_input, int num_bits, bool range_given, string round_mode, string name, bool narrow_range)
Quantizes then dequantizes a tensor.
Parameters
-
IGraphNodeBase
input - A `Tensor` to quantize and dequantize.
-
object
input_min - If range_given=True, the minimum input value that needs to be represented in the quantized representation.
-
object
input_max - If range_given=True, the maximum input value that needs to be represented in the quantized representation.
-
bool
signed_input - True if the quantization is signed or unsigned.
-
int
num_bits - The bitwidth of the quantization.
-
bool
range_given - If true use `input_min` and `input_max` for the range of the input, otherwise determine min and max from the input `Tensor`.
-
string
round_mode - Rounding mode when rounding from float values to quantized ones.
-
string
name - Optional name for the operation.
-
bool
narrow_range - If true, then the absolute value of the quantized minimum value is the same as the quantized maximum value, instead of 1 greater. i.e. for 8 bit quantization, the minimum value is -127 instead of -128.
Returns
-
Tensor
- A `Tensor`. Each element is the result of quantizing and dequantizing the corresponding element of `input`.
object quantize_and_dequantize_dyn(object input, object input_min, object input_max, ImplicitContainer<T> signed_input, ImplicitContainer<T> num_bits, ImplicitContainer<T> range_given, ImplicitContainer<T> round_mode, object name, ImplicitContainer<T> narrow_range)
Quantizes then dequantizes a tensor.
Parameters
-
object
input - A `Tensor` to quantize and dequantize.
-
object
input_min - If range_given=True, the minimum input value that needs to be represented in the quantized representation.
-
object
input_max - If range_given=True, the maximum input value that needs to be represented in the quantized representation.
-
ImplicitContainer<T>
signed_input - True if the quantization is signed or unsigned.
-
ImplicitContainer<T>
num_bits - The bitwidth of the quantization.
-
ImplicitContainer<T>
range_given - If true use `input_min` and `input_max` for the range of the input, otherwise determine min and max from the input `Tensor`.
-
ImplicitContainer<T>
round_mode - Rounding mode when rounding from float values to quantized ones.
-
object
name - Optional name for the operation.
-
ImplicitContainer<T>
narrow_range - If true, then the absolute value of the quantized minimum value is the same as the quantized maximum value, instead of 1 greater. i.e. for 8 bit quantization, the minimum value is -127 instead of -128.
Returns
-
object
- A `Tensor`. Each element is the result of quantizing and dequantizing the corresponding element of `input`.