I have always been confused about this behaviour
Let us say I am implementing an autoencoder. My source and target are going to be same, let us say I want to reconstruct some vector x.
So something like
z = Encoder(x)
y = Decoder(z)


loss = LOSS(y, x)


loss = LOSS(y, x.clone())


loss = LOSS(y, x.clone().detach())


What is the difference in behavior in each of the cases, x is of course a leaf tensor, but I don’t understand the gradients aspect is it 1) going to form a cycle ?