torch.autograd.backward
torch.autograd.backward(tensors, grad_tensors=None, retain_graph=None, create_graph=False, grad_variables=None, inputs=None)
Computes the sum of gradients of given tensors with respect to
   graph leaves.
The graph is differentiated using the chain rule. If any of
   "tensors" are non-scalar (i.e. their data has more than one
   element) and require gradient, then the Jacobian-vector product
   would be computed, in this case the function additionally requires
   specifying "grad_tensors". It should be a sequence of matching
   length, that contains the "vector" in the Jacobian-vector product,
   usually the gradient of the differentiated function w.r.t.
   corresponding tensors ("None" is an acceptable value for all
   tensors that don't need gradient tensors).
This function accumulates gradients in the leaves - you might need
   to zero ".grad" attributes or set them to "None" before calling it.