If range_given=True, the minimum input value, that needs to be
represented in the quantized representation. If axis is specified, this
should be a vector of minimum values for each slice along axis.
input_max
If range_given=True, the maximum input value that needs to be
represented in the quantized representation. If axis is specified, this
should be a vector of maximum values for each slice along axis.
signed_input
True if the quantization is signed or unsigned.
num_bits
The bitwidth of the quantization.
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.
round_mode
Rounding mode when rounding from float values to quantized ones.
one of ['HALF_TO_EVEN', 'HALF_UP']
name
Optional name for the operation.
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.
axis
Integer. If specified, refers to a dimension of the input tensor, such
that quantization will be per slice along that dimension.
Returns
A Tensor. Each element is the result of quantizing and dequantizing the
corresponding element of input.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf.quantization.quantize_and_dequantize\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/ops/array_ops.py#L5896-L5960) |\n\nQuantizes then dequantizes a tensor. (deprecated)\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.quantization.quantize_and_dequantize`](https://www.tensorflow.org/api_docs/python/tf/quantization/quantize_and_dequantize)\n\n\u003cbr /\u003e\n\n tf.quantization.quantize_and_dequantize(\n input,\n input_min,\n input_max,\n signed_input=True,\n num_bits=8,\n range_given=False,\n round_mode='HALF_TO_EVEN',\n name=None,\n narrow_range=False,\n axis=None\n )\n\n| **Deprecated:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: This Op has been deprecated, use`quantize_and_dequantize_v2` instead. To To simulate the V1 the behavior of tf.quantization.quantize_and_dequantize(...) use tf.grad_pass_through(tf.quantization.quantize_and_dequantize_v2)(...).\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `input` | A `Tensor` to quantize and dequantize. |\n| `input_min` | If range_given=True, the minimum input value, that needs to be represented in the quantized representation. If axis is specified, this should be a vector of minimum values for each slice along axis. |\n| `input_max` | If range_given=True, the maximum input value that needs to be represented in the quantized representation. If axis is specified, this should be a vector of maximum values for each slice along axis. |\n| `signed_input` | True if the quantization is signed or unsigned. |\n| `num_bits` | The bitwidth of the quantization. |\n| `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`. |\n| `round_mode` | Rounding mode when rounding from float values to quantized ones. one of \\['HALF_TO_EVEN', 'HALF_UP'\\] |\n| `name` | Optional name for the operation. |\n| `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. |\n| `axis` | Integer. If specified, refers to a dimension of the input tensor, such that quantization will be per slice along that dimension. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Tensor`. Each element is the result of quantizing and dequantizing the corresponding element of `input`. ||\n\n\u003cbr /\u003e"]]