title: pytorch backprop through volatile variable error
body: <p>I'm trying to minimize some input relative to some target by running it through several backward pass iterations and updating the input at each step. The first pass runs successfully but I get the following error on the second pass:
  <code>
  RuntimeError: element 0 of variables tuple is volatile
  </code></p>
  
  <p>This code snippet demonstrates the problem</p>
  
  <pre><code>import torch
  from torch.autograd import Variable
  import torch.nn as nn
  
  inp = Variable(torch.Tensor([1]), requires_grad=True)
  target = Variable(torch.Tensor([3]))
  
  loss_fn = nn.MSELoss()
  
  for i in range(2):
      loss = loss_fn(inp, target)
      loss.backward()
      gradient = inp.grad
      inp = inp - inp.grad * 0.01
  </code></pre>
  
  <p>When I inspect the value of <code>inp</code>, before it is reassigned on the last line, <code>inp.volatile =&gt; False</code> and <code>inp.requires_grad =&gt; True</code> but after it is reassigned those switch to <code>True</code> and <code>False</code>, respectively. Why does being a volatile variable prevent the second backprop run?</p>