ptrblck:

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.


Ah ok, I think that the docs for tensor.backwards() 1 confused me because they said that the arg: gradient := “Gradient w.r.t. the tensor.” (which makes it sound like gradient w.r.t. itself).