View source on GitHub
|
Perform per-tensor or per-channel fake quantization.
tf.keras.quantizers.fake_quant_with_min_max_vars(
inputs, min_vals, max_vals, num_bits=8, narrow_range=False, axis=None
)
[min_vals, max_vals] define the clamping range for the inputs.
The inputs are quantized into the quantization range:
[0, 2^num_bits - 1]whennarrow_range=False[1, 2^num_bits - 1]whennarrow_range=True
After quantization, the values are dequantized and output as floats within
the [min_vals, max_vals] interval.
This operation supports gradient computation, allowing min_vals and
max_vals to be trained.
Returns | |
|---|---|
Tensor
|
A Keras tensor with fake quantization applied. |
View source on GitHub