Lyken17 / pytorch-OpCounter

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

[feature] Can it support only calculate the parameters which `requires_grad == True`? #190

Closed Freed-Wu closed 1 year ago

Freed-Wu commented 2 years ago

Thanks.

SysuJayce commented 1 year ago

I have the same problem when setting weight in __init__() with nn.Parameter() manually and call nn.functional.conv in forward()

Freed-Wu commented 1 year ago

I suggest https://github.com/TylerYep/torchinfo which support displaying:

Total params: 11,689,512
Trainable params: 11,689,512
Non-trainable params: 0
Total mult-adds (G): 2.37