pytorch-pruning
pytorch-pruning copied to clipboard
Python 3.6, pytorch 0.4.1, getting RuntimeError: Dimension out of range (expected to be in range of [-2, 1], but got 3)
My running environment is:
-
Ubuntu 16.04LTS
-
pytorch 0.4.1
-
python 3.6
I got a problem is:
`/home/wangshuo/anaconda3/envs/pytorch/lib/python3.6/site-packages/torchvision-0.2.1-py3.6.egg/torchvision/transforms/transforms.py:188: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead.
/home/wangshuo/anaconda3/envs/pytorch/lib/python3.6/site-packages/torchvision-0.2.1-py3.6.egg/torchvision/transforms/transforms.py:563: UserWarning: The use of the transforms.RandomSizedCrop transform is deprecated, please use transforms.RandomResizedCrop instead.
Accuracy : 1.0
Number of prunning iterations to reduce 67% filters 5
Ranking filters..
Traceback (most recent call last):
File "finetune.py", line 270, in
RuntimeError: Dimension out of range (expected to be in range of [-2, 1], but got 3) ` I have tried the solution given in https://github.com/jacobgil/pytorch-pruning/issues/6#issuecomment-332757962. This problem still exists.
Can anyone help me solve it?
Thanks!
pytorch version caused the problem, you can change to this: values =
torch.sum((activation * grad), dim=0, keepdim = True).
sum(dim=2, keepdim = True).sum(dim=3,keepdim = True)[0, :, 0, 0].data
@wuzhiyang2016 I used keepdim=True, but I still get errors at the same point.
RuntimeError: The size of tensor a (14) must match the size of tensor b (28) at non-singleton dimension 3 Any idea?
Thanks!
@wuzhiyang2016 I used keepdim=True, but I still get errors at the same point.
RuntimeError: The size of tensor a (14) must match the size of tensor b (28) at non-singleton dimension 3 Any idea?
Thanks!
what's your pytorch version? and your error is not "Dimension out of range (expected to be in range of [-2, 1], but got 3)"
@bidakos Have you solved this problem? I need your help and I met same issue, pls help me