Solved by albanD in post #6 
              
              
                Detach is used to break the graph to mess with the gradient computation. 
In 99% of the cases, you never want to do that. 
The only weird cases where it can be useful are the ones I mentioned above where you want to use a Tensor that was used in a differentiable function for a function that is not e…