FakeQuantize(observer=<class 'torch.ao.quantization.observer.MovingAverageMinMaxObserver'>, quant_min=None, quant_max=None, **observer_kwargs)¶
Simulate the quantize and dequantize operations in training time. The output of this module is given by:
x_out = ( clamp(round(x/scale + zero_point), quant_min, quant_max) - zero_point ) * scale
scaledefines the scale factor used for quantization.
zero_pointspecifies the quantized value to which 0 in floating point maps to
fake_quant_enabledcontrols the application of fake quantization on tensors, note that statistics can still be updated.
observer_enabledcontrols statistics collection on tensors
dtypespecifies the quantized dtype that is being emulated with fake-quantization,
allowable values are torch.qint8 and torch.quint8.
observer (module) – Module for observing statistics on input tensors and calculating scale and zero-point.
observer_kwargs (optional) – Arguments for the observer module
~FakeQuantize.activation_post_process (Module) – User provided module that collects statistics on the input tensor and provides a method to calculate scale and zero-point.