Lyken17 / pytorch-OpCounter

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

Fix error about sofmax and adding OnnxProfile #147

Closed HaoKang-Timmy closed 3 years ago

HaoKang-Timmy commented 3 years ago
  1. Fix bug about softmax and add it to dictionary
  2. adding instance_norm,layernorm,prelu to dictionary
  3. seperate basic_hook.py to basic_hook.py and counter.py
  4. adding OnnxProfile, which support all models like profiler except about rnn_hooks
HaoKang-Timmy commented 3 years ago

already have test these models

model_name Macs Params
alexnet 774559016 61100840
vgg11 8155878888 132863336
vgg13 11860071912 133047848
vgg13_bn 11860071912 133047848
vgg16 16023174632.0 138357544
vgg16_bn 16023174632.0 138357544
resnet18 1828891112.0 11684712
resnet34 3679833576.0 21789160
resnet50 4303772136.0 25530472
resnet101 8021111272.0 44496488
wide_resnet101_2 22977748968.0 126817768
densenet121 2843474920.0 8040040
densenet161 7744864168.0 28855720
densenet169 3370009320.0 14276200
densenet201 4302354664.0 20205160
squeeze1_0 781436416.0 1248424
squeeze1_1 351741288.0 1235496
mnasnet0_5 92491721.0 2208200
mnasnet0_75 197365833.0 3155304
mnasnet1_0 292174953.0 4364352
mnasnet1_3 496637449.0 6257848
mobilenet_v2 365943192.0 3487816