Solved by albanD in post #2 
              
              
                Hi, 
The conclusion from the issue you linked is that this is expected behavior mostly (or something we should forbid people from doing). 
torch.autograd.grad works for vectors as well. What is the issue you encounter when trying to use it?