Closed tuyunbin closed 5 years ago
Problem train_loss = loss.data[0] IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
Solution: Change train_loss = loss.data[0] to train_loss = loss.item()
Problem train_loss = loss.data[0] IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
Solution: Change train_loss = loss.data[0] to train_loss = loss.item()