Sorry, the “immediate backward” probably is a bit off track.
If you want to validate gradients, you can do something like:
log_probs.retain_grad_()
lp2 = log_probs.detach().requires_grad_()
loss1 = loss_fn1(log_probs, ...)
loss2 = loss_fn2(lp2, ...)

and then compare lp2.grad to log_probs.grad.
If you find anything suspicious, please let me know.
Best regards
Thomas