Reputation: 304
I am trying to measure FLOPS for a TFLite model in TF2. I know that Tensorflow 1.x had the tf.profiler, which was awesome for measuring flops. It doesn't seem to work well with tf.keras.
Could anybody please describe how to measure FLOPs for a TFLite model in TF2? I can't seem to find an answer online. Thank you all so much for your time.
Edit: The link commented below does not help with tflite.
Upvotes: 5
Views: 2738
Reputation: 46
I encountered the same problem and wrote a simple python package to roughly calculate FLOPS.
https://github.com/lisosia/tflite-flops
Only Conv and DepthwiseConv layers are considered, but it was sufficient for my use case.
Upvotes: 3
Reputation: 94
Unfortunately, there's no direct way you can calculate the FLOPS for a tflite model. However, you can estimate its value indirectly, by following these 3 steps:
The final result will probably be a rough approximation, but it still can bring some value to your performance analysis.
Upvotes: 1