Understanding tensor.backwards()

If you are trying to calculate the dLoss/dLoss, then it would be torch.ones, that’s correct.
For other use cases it might be different. Recently such a use case was described here.

1 Like