Solved by ptrblck in post #2 
              
              
                This error is raised, if you are trying to call backward() on a tensor, which isn’t attached to the computation graph and you can verify it by checking its .grad_fn attribute which would return None. 
This might happen, if you’ve detached the tensors manually (e.g. via calling detach() directly, usi…