vai_q_tensorflow2 supports data type conversions for float models, including
Float16, BFloat16, Float, and Double. The following code shows how to perform the data
type conversions with vai_q_tensorflow2 API.
model = tf.keras.models.load_model('float_model.h5')
from tensorflow_model_optimization.quantization.keras import vitis_quantize
quantizer = vitis_quantize.VitisQuantizer(model)
quantized_model = quantizer.quantize_model(convert_datatype='float16'
**kwargs)
- convert_datatype
- String. Indicates the target data type for the float model. Options are float16, bfloat16, float32, and float64. The default value is float16.