darts icon indicating copy to clipboard operation
darts copied to clipboard

Getting Index Error

Open shashi19081994 opened this issue 4 years ago • 1 comments

@quark0 Sir, IndexError: invalid index of a 0-dim tensor. Use tensor.item() in Python or tensor.item<T>() in C++ to convert a 0-dim tensor to a number

I am getting the above error when i try to run the following command " cd cnn && python test.py --auxiliary --model_path cifar10_model.pt" for cifar 10 Error 1

Thank you in Advance.

shashi19081994 avatar Jun 19 '20 07:06 shashi19081994

The index error occurs in PyTorch >= 0.5. You could replace loss.data[0] by loss.data and all other related areas, or downgrade the PyTorch version. For more information about this error, you could refer to this link.

DominickZhang avatar Jun 28 '20 04:06 DominickZhang