Eric-mingjie / network-slimming

Network Slimming (Pytorch) (ICCV 2017)
MIT License
907 stars 214 forks source link

IndexError: index 0 is out of bounds for dimension 0 with size 0 #56

Open jiagnhaiyang opened 3 years ago

jiagnhaiyang commented 3 years ago

在运行 vggprune.py时出现了这个错误 应该怎么改呢? IndexError: index 0 is out of bounds for dimension 0 with size 0

Eric-mingjie commented 3 years ago

We used pytorch 0.3.1.

RapBleach commented 3 years ago

I have met a same problem, I train a vgg-11 model for cifar10 with 40 epochs, and I prune it for 0.1, 0.2, and so on. Before 0.5,there is no problem and I get the pruned network. But when I try to prune it for 0.6, it shows something wrong like the title. So can you find some reasons for it ?

And my pytorch version is 1.7.0 . Maybe it is too high? the shell for 0.7 pruning is : "python vggprune.py --dataset cifar10 --depth 11 --percent 0.7 --model ./vgg11/model_best.pth.tar --save ./vgg11/0.7" I've changed it based my 0.4 pruning shell ,just the "--percent" and "--save" .

aoller-Jr commented 2 years ago

Maybe you should pay attention to the element value in cfg. If it contains 0, this error will occur. Modifying the pruning percent can solve this problem.