Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Jit profile #150

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open

Adding Jit profile #150

wants to merge 26 commits into from

Conversation

HaoKang-Timmy
Copy link
Contributor

  1. Adding class JitProfile, which can count macs and params
  2. fix some bugs in counter

@@ -12,11 +12,11 @@ def count_parameters(m, x, y):
total_params = 0
for p in m.parameters():
total_params += torch.DoubleTensor([p.numel()])
m.total_params[0] = total_params
m.total_params[0] = counter_parameters(m.parameters())
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why call count_parameters() here? total_params already provides the number of parameters of the model.

results = dict()
graph = trace(model, args)
for node in graph.nodes:
for operators, func in handlers:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an O(N) operation and will become slow when the number of handlers increases. I suggest to rework it to dictionary.

@HaoKang-Timmy
Copy link
Contributor Author

model macs params
alexnet 7.7406e+08 61100840
vgg11 8.1484e+09 132863336
vgg11_bn 8.1559e+09 132868840
vgg13 8.1559e+09 132868840
vgg13_bn 1.1860e+10 133053736
vgg16 1.6010e+10 138357544
vgg19 2.0171e+10 143667240
resnet18 1.8163e+09 11689512
resnet50 4.1024e+09 25557032
wide_resnet101_2 2.2776e+10 126886696
densenet121 2.8500e+09 7978856
squeezenet1_0 8.1893e+08 1248424
mnasnet0_75 2.2062e+08 3170208
mobilenet_v2 3.0781e+08 3504872

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants