Closed zhuweizzz closed 1 month ago
That is correct, TFLite-Micro does not support models quantized to float16. This is because the hardware targets using TFLite-Micro rarely have hardware floating point support, so it becomes prohibitively expensive to use a floating point model in production. We currently only support float32 with reference kernels. We generally recommend using full integer quantization. If applicable for your use case, TFLite does support float16.
I built and trained a CNN model using TensorFlow, and used the TensorFlow Lite Converter to convert the trained model into a TFLite model.
I compiled and successfully ran the model in TFLite-Micro.
I noticed that it's possible to perform float16 quantization when using the Converter.
The quantized model compiled successfully in TFLite-Micro, but encountered errors during runtime.
Based on the error message, I located the problematic area in the file tensorflow/lite/micro/kernels/dequantize_common.cc, where the input type check for the Dequantize operation on line 43 seems to only support Int8, Int16, and Uint8.
However, in a TFLite model quantized to float16, the input for the Dequantize operation is of float16 type. Does this mean that TFLite-Micro does not support models quantized to float16?