higgsfield/np-hard-deep-reinforcement-learning

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

LT1st opened this issue · 1 comments

LT1st commented

IndexError Traceback (most recent call last)
in ()
18 adam.step()
19
---> 20 train_loss.append(loss.data[0])
21
22 if batch_id % 10 == 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

change loss.data[0] to loss.item()