he-y / soft-filter-pruning

Soft Filter Pruning for Accelerating Deep Convolutional Neural Networks
https://arxiv.org/abs/1808.06866
374 stars 74 forks source link

sh scripts/cifar10_resnet.sh error #19

Closed zhanghongruiupup closed 4 years ago

zhanghongruiupup commented 4 years ago

cifar-10-python.tar.gz Data set downloaded by myself. root(/data/cifar.python/cifar-10-python.tar.gz) then run sh scripts/cifar10_resnet.sh but it not work info: => do not use any checkpoint for resnet110 model ----------one epoch begin---------- the compression rate now is 0.700000 pruning_cifar10_resnet.py:305: UserWarning: volatile was removed and now has no effect. Use with torch.no_grad(): instead. input_var = torch.autograd.Variable(input, volatile=True) pruning_cifar10_resnet.py:306: UserWarning: volatile was removed and now has no effect. Use with torch.no_grad(): instead. target_var = torch.autograd.Variable(target, volatile=True) Traceback (most recent call last): File "pruning_cifar10_resnet.py", line 467, in main() File "pruning_cifar10_resnet.py", line 177, in main val_acc_1, val_los_1 = validate(test_loader, net, criterion, log) File "pruning_cifar10_resnet.py", line 315, in validate top1.update(prec1[0], input.size(0)) IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number

hope your reply

zhanghongruiupup commented 4 years ago

.item() replace .data[0] . it work,thanks