How to determine whether a TFLite model is int8 quantized?

21 views
Skip to first unread message

Jiacong Fang

unread,
Aug 19, 2021, 3:37:07 AMAug 19
to tfl...@tensorflow.org
Hello, everyone!

I have models exported to TFLite format. One is an fp16 model, and the other is an int8 model. How could I discriminate between these two models?  I have searched on Google and issues in the Github TensorFlow repo, but there is no discussion about this topic.

I tried to read the scale of quantization of the input tensor in the two models. The scale of fp16 is zero, while the scale of int8 is 0.00392 approximately, as shown in the image below.
image.png
 I would like to use the value of scale to discriminate, but I am afraid that other fp16 models may have a non-zero value of scale.

How could I determine whether a TFLite model is int8 quantized?

Best regards,
Jiacong Fang
 

Jaesung Chung

unread,
Aug 19, 2021, 5:50:00 AMAug 19
to TensorFlow Lite, zldr...@gmail.com
It is possible to determine whether TFLite model is int8 quantized by loading the model byte array from the flatbuffer library or the TFLite interpreter and then, looking for any int8 tensor types from the tensor table.
Reply all
Reply to author
Forward
0 new messages