[英]Measuring Flops for TFLite Model in Tensorflow 2.X
I am trying to measure FLOPS for a TFLite model in TF2.我正在尝试测量 TF2 中 TFLite model 的 FLOPS。 I know that Tensorflow 1.x had the tf.profiler, which was awesome for measuring flops.
我知道 Tensorflow 1.x 有 tf.profiler,它非常适合测量翻牌。 It doesn't seem to work well with tf.keras.
它似乎不适用于 tf.keras。
Could anybody please describe how to measure FLOPs for a TFLite model in TF2?有人可以描述如何在 TF2 中测量 TFLite model 的 FLOPs 吗? 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.编辑:下面评论的链接对 tflite 没有帮助。
Unfortunately, there's no direct way you can calculate the FLOPS for a tflite model.不幸的是,没有直接的方法可以计算 tflite model 的 FLOPS。 However, you can estimate its value indirectly, by following these 3 steps:
但是,您可以通过以下 3 个步骤间接估计其价值:
The final result will probably be a rough approximation, but it still can bring some value to your performance analysis.最终结果可能是一个粗略的近似值,但它仍然可以为您的性能分析带来一些价值。
I encountered the same problem and wrote a simple python package to roughly calculate FLOPS.我遇到了同样的问题,写了一个简单的 python package 来粗略计算 FLOPS。
https://github.com/lisosia/tflite-flops https://github.com/lisosia/tflite-flops
Only Conv and DepthwiseConv layers are considered, but it was sufficient for my use case.只考虑了 Conv 和 DepthwiseConv 层,但这对我的用例来说已经足够了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.