sovrasov / flops-counter.pytorch

Flops counter for convolutional networks in pytorch framework
MIT License
2.82k stars 307 forks source link

The flops calculation of ConvTranspose2d (Deconv) #57

Closed Spark001 closed 3 years ago

Spark001 commented 3 years ago

The flops of ConvTranspose2d operation maybe not correct?

It should be calculated as same as Conv2d: K_w*K_h*C_in*C_out*O_w*O_h when group = 1.

However your implement is K_w*K_h*C_in*C_out*I_w*I_h as follows:

https://github.com/sovrasov/flops-counter.pytorch/blob/b35716da617b57cb96944b113928d54b8b9ee9b6/ptflops/flops_counter.py#L297

sovrasov commented 3 years ago

Indeed, that's a bug. Thanks for figuring out, I'll fix it.

sovrasov commented 3 years ago

Resolved in #58