sovrasov / flops-counter.pytorch

Flops counter for convolutional networks in pytorch framework
MIT License
2.83k stars 306 forks source link

Misleading of the MACS and FLOPS #40

Open ProNoobLi opened 4 years ago

ProNoobLi commented 4 years ago

Hey, it's a nice tool However, I am wondering whether the return of get_model_complexity_info is correct.

Let's assume all calculations are in floating point. 1MACs = 2OPs MAC = Mult + Add FLOPS = 2MACS(roughly equivalent, especially those models set up by all convolutional layers)

Thus, in your code: image The returns show flops_count, params_count

However, all printing result from the function flops_to_string are in Mac image The return type is not consistent with the example as well image

The units in flops_to_string are supposed to be flops instead of mac. Otherwise, half the flops to macs. Could you please check it out again?

sovrasov commented 4 years ago

Hi! There is no problem here: everywhere variables named flops are handled as macs. The code needs refactoring to get rid of this confusion.