Correct me if I am wrong. Pytorch does not allow in place modification because it needs to know all the operations carried out so that it can compute gradient in the future. So right now, since I clone the variable and do something to it and pass this new variable f_y into the criterion to calculate loss, autograd wouldn’t know these operations that are done to x_dot_wT and would assume that the loss is calculated directly using x_dot_wT and so it would be different from the case where autograd knows these modifications when I do not clone?
So in my code when I do loss.backward(), pytorch thinks that the loss is computed using x_dot_wT and not f_y? Is that the case?