|View source on GitHub|
Quantize tensor based on min/max of tensor values with the fixed range.
tfmot.quantization.keras.quantizers.FixedQuantizer( num_bits, init_min, init_max, narrow_range )
||Number of bits for quantization|
||the lower end of quantization interval.|
||the upper end of quantization interval.|
||In case of 8 bits, narrow_range nudges the quantized range to be [-127, 127] instead of [-128, 127]. This ensures symmetric range has 0 as the centre.|
build( tensor_shape, name, layer )
Construct the weights required by the quantizer.
A quantizer may need to construct variables to hold the state for its
algorithm. This function is invoked during the
build stage of the layer
that the quantizer is used for. Any variables constructed are under the
scope of the
layer and serialized as part of the layer.
||Shape of tensor which needs to be quantized.|
||Name of tensor.|
||Keras layer which is quantizing the tensors. The layer is needed to construct the weights, and is also the owner of the weights.|
Returns: Dictionary of constructed weights. This dictionary will be
passed to the quantizer's call function as a
from_config( config )
Quantizer from its config.
Returns the config used to serialize the
__call__( inputs, training, weights, **kwargs )
||Input tensor to be quantized.|
||Whether the graph is currently training.|
Dictionary of weights the quantizer can use to quantize the
tensor. This contains the weights created in the
||Additional variables which may be passed to the quantizer.|
__eq__( other )
__ne__( other )