Lyken17 / pytorch-OpCounter

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

question about BN #226

Open dyhBUPT opened 4 months ago

dyhBUPT commented 4 months ago

Hi, I have a question about BN here: https://github.com/Lyken17/pytorch-OpCounter/blob/43c064afb71383501e41eaef9e8c8407265cf77f/thop/vision/basic_hooks.py#L60-L69

https://github.com/Lyken17/pytorch-OpCounter/blob/43c064afb71383501e41eaef9e8c8407265cf77f/thop/vision/calc_func.py#L43-L45

Maybe the MACs of BN (eval, no affine) should be x.numel(), not 2 * x.numel()?

woailunhua commented 3 months ago

他这个咋算的啊,就单单均值和方差的计算都不止这些吧。 如果不考虑eps,如果输入是(b,l,d)我算的flops是7bld+bl,用大O表示法就是BLD