flops-counter.pytorch icon indicating copy to clipboard operation
flops-counter.pytorch copied to clipboard

FLOPS in ResNet50_ImageNet

Open miltonmondal opened this issue 3 years ago • 4 comments

Getting 4.12B flops using your code whereas almost all research papers mentioned 4.09B flops for this configuration

(pytorch default 76.15% test accuracy for pretrained model)

Can you please modify the code or mention the reason for getting 0.03B increase in FLOPs?

miltonmondal avatar Jun 14 '22 17:06 miltonmondal

fvcore will get the output of 4.09G, but it will also print

Skipped operation aten::batch_norm 53 time(s)
Skipped operation aten::max_pool2d 1 time(s)
Skipped operation aten::add_ 16 time(s)
Skipped operation aten::adaptive_avg_pool2d 1 time(s)

Perhaps those papers ignore the computation of some of the operators.

jkhu29 avatar Nov 15 '22 10:11 jkhu29

@jkhu29 you're right! ptflops also considers batch norms and poolings as non-zero ops, that's why it outputs slightly greater numbers than expected.

sovrasov avatar Nov 16 '22 12:11 sovrasov