When I saw some demo codes:
outputs = model(inputs) _, preds = torch.max(outputs.data, 1) loss = criterion(outputs, labels)
# backward + optimize only if in training phase if phase == 'train': loss.backward() optimizer.step()
# statistics running_loss += loss.data
If we would like to extract the loss tensor from loss variable, why not use loss.data?
What does loss.data mean here?