The construction function of class VitisQuantizer.
vitis_quantize.VitisQuantizer(
float_model,
quantize_strategy='pof2s',
custom_quantize_strategy=None,
custom_objects={})
Arguments
- float_model
- A
tf.keras.Modelobject, containing the configurations for quantization. - quantize_strategy
- A string object of the quantize strategy type. Available
values are
pof2s,pof2s_tqt,fsandfsx.pof2sis the default strategy that uses power-of-2 scale quantizer and the Straight-Through-Estimator.pof2s_tqtis a strategy introduced in Vitis AI 1.4 which uses Trained-Threshold in power-of-2 scale quantizers and may generate better results for QAT.fsis a new quantize strategy introduced in Vitis AI 2.5, it do float scale quantization for inputs and weights of Conv2D, DepthwiseConv2D, Conv2DTranspose and Dense layers.fsxquantize strategy do quantization for more layer types than fs quantize straetgy, such as Add, MaxPooling2D and AveragePooling2D. Moreover, it also quantizes the biases and activations.Note: pof2s_tqt strategy should only be used in QAT and be used together withinit_quant=Trueto get the best performance.Note:fsandfsxstrategy are designed for target devices with floating-point supports. DPU does not have floating-point support now, so models quantized with these quantize strategies can not be deployed to them. - custom_quantize_strategy
- A string object, the file path of custom quantize strategy JSON file.
- custom_objects
- A Dict object, mapping names (strings) to custom classes or functions.