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
时间:2021-04-23 16:41:28
收藏:0
阅读:292
报错的时候,是因为loss.data[0]
修改后变为loss.item()
原文:https://www.cnblogs.com/hao-lingguang19/p/14692631.html
评论(0)