Solved by ptrblck in post #4 
              
              
                I would avoid using the .data attribute anymore and instead wrap the code in a 
with torch.no_grad():
    ...

block if necessary. 
Autograd cannot warn you, if you manipulate the underlying tensor.data, which might lead to wrong results.