IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
python版本问题,将原语句
PrivateTest_loss += loss.data[0]
改成
PrivateTest_loss += loss.item()
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
python版本问题,将原语句
PrivateTest_loss += loss.data[0]
改成
PrivateTest_loss += loss.item()