You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "main.py", line 152, in
train(epoch)
File "main.py", line 120, in train
100. * batch_idx / len(train_loader), loss.data[0]))
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
The text was updated successfully, but these errors were encountered:
That's a version problem. Replace 100. * batch_idx / len(train_loader), loss.data[0])) in line 120 with 100. * batch_idx / len(train_loader), loss.data.item())) and test_loss += F.cross_entropy(output, target, size_average=False).data[0] in line 131 with test_loss += F.cross_entropy(output, target, size_average=False).data.item()
Traceback (most recent call last):
File "main.py", line 152, in
train(epoch)
File "main.py", line 120, in train
100. * batch_idx / len(train_loader), loss.data[0]))
IndexError: invalid index of a 0-dim tensor. Use
tensor.item()
in Python ortensor.item<T>()
in C++ to convert a 0-dim tensor to a numberThe text was updated successfully, but these errors were encountered: