Solved by vmirly1 in post #2 
              
              
                So, s you said, x.clone() maintains the connection with the computation graph. That means, if you use the new cloned tensor, and derive the loss from the new one, the gradients of that loss can be computed all the way back even beyond the point where the new tensor was created. However, if you detac…