File "static.py", line 10, in
stat(model,(3,224,224))
File "/home/sk49/.local/lib/python3.6/site-packages/torchstat/statistics.py", line 71, in stat
ms.show_report()
File "/home/sk49/.local/lib/python3.6/site-packages/torchstat/statistics.py", line 64, in show_report
collected_nodes = self._analyze_model()
File "/home/sk49/.local/lib/python3.6/site-packages/torchstat/statistics.py", line 57, in _analyze_model
model_hook = ModelHook(self._model, self._input_size)
File "/home/sk49/.local/lib/python3.6/site-packages/torchstat/model_hook.py", line 24, in init
self._model(x)
File "/home/sk49/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/sk49/.local/lib/python3.6/site-packages/torchvision/models/resnet.py", line 138, in forward
x = self.conv1(x)
File "/home/sk49/.local/lib/python3.6/site-packages/torchstat/model_hook.py", line 78, in wrap_call
Memory = compute_memory(module, input[0], output)
File "/home/sk49/.local/lib/python3.6/site-packages/torchstat/compute_memory.py", line 12, in compute_memory
return compute_Conv2d_memory(module, inp, out)
File "/home/sk49/.local/lib/python3.6/site-packages/torchstat/compute_memory.py", line 57, in compute_Conv2d_memory
mread = batch_size * (inp.size()[1:].numel() + num_params(module))
AttributeError: 'torch.Size' object has no attribute 'numel'
the code just like this :
from torchstat import stat
import torchvision.models as models
model = models.resnet18()
stat(model, (3, 224, 224))
I have the same error. Have you solved it?
I have exactly the same error!
By installing the fixed version from https://github.com/lyakaap/torchstat, I can run the code successfully
By installing the fixed version from https://github.com/lyakaap/torchstat, I can run the code successfully
解决啦多谢,就是下载这个repo的相应版本就行,其实替换comput_parameters.py就ok了