Traceback (most recent call last):
File “”, line 1, in
TypeError: torch.randn received an invalid combination of arguments - got (int, int, requires_grad=bool), but expected one of:
(int … size)
didn’t match because some of the keywords were incorrect: requires_grad
(torch.Size size)
(torch.Generator generator, int … size)
didn’t match because some of the keywords were incorrect: requires_grad
(torch.Generator generator, torch.Size size)
Getting above errors for MSE Loss and cross entropy loss. Please suggest the way out
Tried that as well.
AssertionError: nn criterions don’t compute the gradient w.r.t. targets - please mark these variables as volatile or not requiring gradients
That indicates that you are using requires_grad=True for your target Variable as well, but that should be set to False, as the gradients will be computed w.r.t. the inputs.