Solved by SimonW in post #2 
              
              
                detach is safer as it uses the same version counter as the original tensor. Version counter is a mechanism that helps tracking if some tensor that is needed in backward has been modified inplace.