Base class of quantized-float related Module
, basically for QAT and Calibration.
Use from_float_module
to generate a instance from float Module
.
Or use quantize_qat
to do it recursively and automatically.
Can also be converted to QuantizedModule
for deployment using
quantize
further.
-
apply_quant_activation(target)[source]
Apply weight’s observer and fake_quant from qconfig
on target
.
-
apply_quant_bias(target, inp, w_qat)[source]
Use fake_quant_bias
to process target
. Only valid when
act_fake_quant
and weight_fake_quant
are both enabled.
-
apply_quant_weight(target)[source]
Apply weight’s observer and fake_quant from qconfig
on target
.
-
abstract classmethod from_float_module(float_module)[source]
Return a QATModule
instance converted from
a float Module
instance.
-
get_activation_dtype()[source]
Get activation’s quantization dtype as the method from qconfig
.
-
get_activation_qparams()[source]
Get activation’s quantization parameters.
-
get_weight_dtype()[source]
Get weight’s quantization dtype as the method from qconfig
.
-
get_weight_qparams()[source]
Get weight’s quantization parameters.
-
set_qconfig(qconfig)[source]
Set quantization related configs with qconfig
, including
observer and fake_quant for weight and activation.