vai_q_tensorflow2 Supported Operations and APIs - 3.5 English

Vitis AI User Guide (UG1414)

Document ID
UG1414
Release Date
2023-09-28
Version
3.5 English

The following table lists the supported operations and APIs for vai_q_tensorflow2.

Table 1. vai_q_tensorflow2 Supported Layers
Layer Types  Supported Layers Description
Core tf.keras.layers.InputLayer  
Core tf.keras.layers.Dense  
Core tf.keras.layers.Activation If activation is relu or linear, it is quantized.

If activation is sigmoid or swish, it is converted to hard-sigmoid or hard-swish and then quantized by default.

Otherwise it is not quantized.

Convolution tf.keras.layers.Conv2D  
Convolution tf.keras.layers.DepthwiseConv2D   
Convolution tf.keras.layers.Conv2DTranspose   
Convolution tf.keras.layers.SeparableConv2D  
Pooling tf.keras.layers.AveragePooling2D  
Pooling tf.keras.layers.MaxPooling2D   
Pooling tf.keras.layers.GlobalAveragePooling   
Normalization tf.keras.layers.BatchNormalization  By default, BatchNormalization layers are fused with the previous convolution layers. If they cannot be combined, they are converted to depthwise convolutions.

In the QAT mode, BatchNormalization layers are pseudo-fused if train_with_bn is set to TRUE. They are fused when the get_deploy_model function is called.

Regularization tf.keras.layers.Dropout  By default, the dropout layers are removed. In the QAT mode, dropout layers are retained if remove_dropout is set to FALSE. It is removed when the get_deploy_model function is called.
Reshaping tf.keras.layers.Reshape   
Reshaping tf.keras.layers.Flatten   
Reshaping tf.keras.UpSampling2D   
Reshaping tf.keras.ZeroPadding2D   
Merging tf.keras.layers.Concatenate   
Merging  tf.keras.layers.Add   
Merging tf.keras.layers.Multiply   
Activation tf.keras.layers.ReLU   
Activation tf.keras.layers.Softmax  The input for the Softmax layer is quantized. It can run on the standalone Softmax IP for acceleration.
Activation tf.keras.layers.LeakyReLU Only LeakyReLU layer with "alpha=0." One can be quantized and mapped to DPU. Internally, the quantizer automatically converts the alpha value to 26/256 to match the DPU implementation. LeakyReLU layer with other values is not quantized and is mapped to the CPU.
Hard_sigmoid tf.keras.layer.ReLU(6.)(x + 3.) * (1. / 6.) The supported hard_sigmoid is from Mobilenet_v3.

tf.keras.Activation.hard_sigmoid is not supported now and is not quantized.

Activation tf.keras.layers.PReLU  
Note: The DPU might have limitations on these supported layers. They can be rolled back to the CPU during compilation. For more information, see Supported Operators and DPU Limitations.