提示 Use tensor.item() to convert a 0-dim tensor to a Python number
原语句:running_loss+=loss.data[0]
修改后:running_loss+=loss.item()
提示 Use tensor.item() to convert a 0-dim tensor to a Python number
原语句:running_loss+=loss.data[0]
修改后:running_loss+=loss.item()
本文标题:IndexError: invalid index of a 0
本文链接:https://www.haomeiwen.com/subject/eglyuqtx.html
网友评论