12

I'm posting this question for those who made the same error I did. I got this error when trying to compute my gradients:

criterion = torch.nn.CrossEntropyLoss()
loss = criterion(y_hat, y_truth)
loss.backwards()
Jacob Stern
  • 3,758
  • 3
  • 32
  • 54

1 Answers1

38

It's loss.backward(), not loss.backwards().

Jacob Stern
  • 3,758
  • 3
  • 32
  • 54