Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Check that outputs and grad_outputs have same shape in torch.autograd.grad() #17893
This looks like a good idea, as it will help narrow down the problem in the case of unmatched shapes. The documentation for torch.autograd.grad says,
So, you're right, they should be the same shape (Except when grad_outputs = None). I'd be happy to work on implementing this feature.