Dear smth, thank you very much for your help! And I understood your idea! I  also find another related problem and wish it is helpful for others. Thanks!

  
    
    
    Clarification - Using backward() on non-scalars 
  
  
    Hey, 
Sorry if this is obvious, but I find the description of the torch.autograd.backward(variables, grad_variables, retain_variables=False) function quite confusing. 
I’m working on a project where I have a vector of variables that I would like to differentiate to find the Jacobian. When it comes to implementing this, I’m not sure what form grad_variables should be or what a ‘sequence of Tensor’ is. I’ve tried many things, but all throw an error. 
Would anyone be able to point me in the directi…