I’m playing with image gradients and have seen they want to compute an image gradient with respect the raw class score.  I’ve seen, “ypred=model(batch_img) loss = ypred[range(len(labels)), labels].sum() loss.backward()”  and I’ve seen this “ypred=model(batch_img) loss = ypred[range(len(labels)), labels] loss.backward(torch.ones(labels.shape[0]))”  I know the first implementation is correct.  But I just want to make sure the second implementation is equivalent.  It seems like it’d be correct too.  I get the same image gradients - but I could be lucky.