We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
请问老师这个问题怎么解决觉得?
if (e + 1) % 100 == 0: # 每 100 次输出结果 ---> 12 print('Epoch: {}, Loss: {:.5f}'.format(e + 1, loss.data[0]))
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
The text was updated successfully, but these errors were encountered:
把 loss.data[0] 改成 loss.item() 就可以了,这是版本不一致的问题
Sorry, something went wrong.
谢谢老师。
No branches or pull requests
请问老师这个问题怎么解决觉得?
if (e + 1) % 100 == 0: # 每 100 次输出结果
---> 12 print('Epoch: {}, Loss: {:.5f}'.format(e + 1, loss.data[0]))
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
The text was updated successfully, but these errors were encountered: