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()
It's loss.backward()
, not loss.backwards()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With