Solved by jpeg729 in post #2 
              
              
                For easy reference, here is the code. 
x = Variable(torch.ones(2, 2), requires_grad=True)
y = x + 2
z = y * y * 3
out = z.mean()
out.backward()

PyTorch does not expose the gradients of y and z because they are not “leaf” Variables. 
x is a “leaf” Variable because you created it using Variable(…). 
y…