I see, thanks a lot.
With that division I was trying to reduce the variance of the initial random sampling in X, so the logical way for me to do so was simply once outside the loop. Ideally I would first have declared XX with the reduced variance and then added it to the optimiser, but if done like that pytorch complains that XX is not a leaf variable; ie
x = torch.randn( (5, 4), requires_grad=True ) 
xx = x/10
optimizer = optim.Adam( [xx] )  # ValueError: can't optimize a non-leaf Tensor

Is there any other way to have a tensor in the optimiser that is the result of some previous computations?
Thanks!