I have reviewed the documentation and have one more question. So lets say that gradient has my craft derivatives of the probability vector w.r.t logits that I have to backpropagate. I guess the correct call now would be:
gradients.backward(torch.ones_like(gradients))

Is this equivalent to do gradients.sum().backward()? I guess it is.