Solved by colesbury in post #2 
              
              
                outputs is empty in loss.backward() because that expression doesn’t return the gradients. The gradients are accumulated into the .grad attribute of variables. (Look in accumulate_grad.cpp instead). 
outputs will contain Tensors if you use torch.autograd.grad(loss, <inputs>).