UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number
train_loss += loss.data[0]
将pytorch更新到0.4.0最新版后对0.3.1版本代码会有如下警告,它在提醒用户下个版本这将成为一个错误1.UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python n...