title: Why does autograd not produce gradient for intermediate variables?
body: <p>trying to wrap my head around how gradients are represented and how autograd works:</p>
  
  <pre><code>import torch
  from torch.autograd import Variable
  
  x = Variable(torch.Tensor([2]), requires_grad=True)
  y = x * x
  z = y * y
  
  z.backward()
  
  print(x.grad)
  #Variable containing:
  #32
  #[torch.FloatTensor of size 1]
  
  print(y.grad)
  #None
  </code></pre>
  
  <p>Why does it not produce a gradient for <code>y</code>? If <code>y.grad = dz/dy</code>, then shouldn't it at least produce a variable like <code>y.grad = 2*y</code>?</p>