tf.keras.quantizers.fake_quant_with_min_max_vars
Stay organized with collections
Save and categorize content based on your preferences.
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] when narrow_range=False
[1, 2^num_bits - 1] when narrow_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.
Args |
inputs
|
Input Keras tensor of float dtype.
|
min_vals
|
A global minimum scalar or a per-channel minimum tensor.
|
max_vals
|
A global maximum scalar or a per-channel maximum tensor.
|
num_bits
|
Quantization bit width (e.g., 8 for int8). Defaults to 8.
|
narrow_range
|
Whether to use narrow quantization range. Defaults to
False.
|
axis
|
Axis along which to perform per-channel quantization. If None,
per-tensor quantization is performed. Defaults to None.
|
Returns |
Tensor
|
A Keras tensor with fake quantization applied.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2026-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-10-31 UTC."],[],[]]