vitis_quantize.VitisQuantizer - 3.5 English

Vitis AI User Guide (UG1414)

Document ID
UG1414
Release Date
2023-06-29
Version
3.5 English

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.Model object, containing the configurations for quantization.
quantize_strategy
A string object of the quantize strategy type. Available values are pof2s , pof2s_tqt , fs and fsx . pof2s is the default strategy designed for DPU. It uses power-of-2 scale quantizer and uses the Straight-Through-Estimator for QAT. pof2s_tqt is a QAT-only strategy introduced in Vitis AI 1.4 which uses Trained-Threshold in quantizers and may generate better results for power-of-2 scale QAT. fs is 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. fsx quantize 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 with init_quant=True to get the best performance.
Note: fs and fsx strategies 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 DPU.
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.