Lyken17 / pytorch-OpCounter

Count the MACs / FLOPs of your PyTorch model.
MIT License
4.87k stars 527 forks source link

Contradictory result about 3D CNN #48

Open jfzhuang opened 5 years ago

jfzhuang commented 5 years ago

First of all, thanks to the author's selfless dedication, your code is well written! I have implemented two versions of 3D CNN(separable 3D and P3D) and want to calculate their FLOPs. I found that the FLOPs of separable 3D is much smaller than P3D version using your code (283.237G FLOPs VS 3.246T FLOPs). But when I calculate the inference time averaging in 100 forwards, the P3D version is much faster (0.8194s VS 0.3823s). Is there any problem when calculating computation of 3D CNN?

Lyken17 commented 5 years ago

Can u share some example code? THOP haven't considered much about 3D models, so some details might be missing.

jfzhuang commented 5 years ago

Thanks for your quick reply! Can you provide your email address? I can provide you with network definition files and test code.

Lyken17 commented 5 years ago

I recommend pasting here directly as it would help other people in the future.

jfzhuang commented 5 years ago

OK. Thanks for your kindly help! test.zip