Solved by ptrblck in post #2 
              
              
                The usage of .data is not recommended, as you’ll get access to the “real” underlying data and Autograd cannot track the changes applied on it, which might yield wrong results and thus silent errors. 
If you don’t want to track some changes on your tensors, you should wrap these operations in a with …