Can these newly added keys be removed after the function profile is executed?
newcomertzc opened this issue · comments
newcomertzc commented
My Python version: 3.8.12 / 3.8.13
My Pytorch version: 1.8.2 / 1.10.1
Run the following code:
from torchvision import models
from thop.profile import profile
import torch
net = models.resnet50()
x = torch.randn(1, 3, 224, 224)
oringinal_keys = net.state_dict().keys()
profile(net, (x,))
current_keys = net.state_dict().keys()
print(current_keys - oringinal_keys)
the output is as follows:
{'layer1.0.downsample.total_ops',
'layer1.0.downsample.total_params',
'layer1.0.total_ops',
'layer1.0.total_params',
'layer1.1.total_ops',
'layer1.1.total_params',
'layer1.2.total_ops',
'layer1.2.total_params',
'layer1.total_ops',
'layer1.total_params',
'layer2.0.downsample.total_ops',
'layer2.0.downsample.total_params',
'layer2.0.total_ops',
'layer2.0.total_params',
'layer2.1.total_ops',
'layer2.1.total_params',
'layer2.2.total_ops',
'layer2.2.total_params',
'layer2.3.total_ops',
'layer2.3.total_params',
'layer2.total_ops',
'layer2.total_params',
'layer3.0.downsample.total_ops',
'layer3.0.downsample.total_params',
'layer3.0.total_ops',
'layer3.0.total_params',
'layer3.1.total_ops',
'layer3.1.total_params',
'layer3.2.total_ops',
'layer3.2.total_params',
'layer3.3.total_ops',
'layer3.3.total_params',
'layer3.4.total_ops',
'layer3.4.total_params',
'layer3.5.total_ops',
'layer3.5.total_params',
'layer3.total_ops',
'layer3.total_params',
'layer4.0.downsample.total_ops',
'layer4.0.downsample.total_params',
'layer4.0.total_ops',
'layer4.0.total_params',
'layer4.1.total_ops',
'layer4.1.total_params',
'layer4.2.total_ops',
'layer4.2.total_params',
'layer4.total_ops',
'layer4.total_params',
'total_ops',
'total_params'}
Omar Moured commented
Did you manage to find a way to remove the additional keys? Anyone from the authors to solve this issue, please!
Mingzhe LV commented
Did you manage to find a way to remove the additional keys? Anyone from the authors to solve this issue, please!
I think this issue has been solved by the authors, please update your version.