torch-light
torch-light copied to clipboard
invalid index of a 0-dim tensor
Hi ne7ermore, Thank you a lot for your code sharing. I was running your retrieval chatbot code train.py and encountered the following error:
Traceback (most recent call last):
File "train.py", line 141, in
I searched for the reason and solution, and found that it was a Pytorch version issue, in version > 0.5 you have to change loss.data[0] to loss.item() as indicated in the error message. I just post this issue in order to remind others. P.S. It seemed that loss.data.item() also worked.