I see your point but my calculations are just not agreeing with that.
I’ll make things a bit clearer
I’ll change the notations to:
loss1 = torch.sum(loss*target_onehot)

And let’s denote:
S(out) = softmax(out)
Now:
dloss1/dloss = [ target_onehot[0] ,  target_onehot[1]]
dloss/dout=[[S(out[0])S(out[0]),S(out[0])(1-S(out[1])) ],
[S(out[1])(1-S(out[0])),S(out[1])S(out[1])]]
dout/db = [[1 , 1] , [1, 1]]
dloss1/db = dloss1/dloss * dloss/dout * dout/db
If dloss1/dloss is:[1,1] -> I don’t see how it make the grad equal zero. (unless for very specific S() values.)