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
报错的时候,是因为loss.data[0]
修改后变为loss.item()
posted on 2021-04-23 10:22 Attack-DrHao 阅读(1275) 评论(0) 编辑 收藏 举报