rethinking-network-pruning
rethinking-network-pruning copied to clipboard
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
Traceback (most recent call last):
File "main.py", line 166, in
Use torch v0.3.1.
If you want to use Pytorch >= 0.4.1, you have to edit some code. Here is the source code I converted https://github.com/songheony/rethinking-network-pruning. I've tested it with Pytorch 1.2, CUDA 10
avg_loss += loss.data[0]
Replace avg_loss += loss.data[0] with avg_loss += loss.item()