I think you want torch.autograd.backward(variables, grads):
http://pytorch.org/docs/autograd.html#torch.autograd.backward 1.0k
It takes a list of variables and a list of gradients (one for each variable).