title: PyTorch - modifications of autograd variables
body: <p>In my PyTorch program, I have a matrix which is continuously updated over runtime.</p>
  
  <p>I wonder how to perform this update. I tried using something like this:</p>
  
  <pre><code>matrix[0, index] = hidden[0]
  </code></pre>
  
  <p>Both <code>matrix</code> and <code>hidden</code> are autograd Variables. When using the example above I'm getting the following error message:</p>
  
  <pre><code>RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation
  </code></pre>
  
  <p>I wonder how to get around this and perform the update without using in-place operations.</p>
  
  <p>Probably slicing the matrix and creating a new matrix with torch.cat would work, but this doesn't seem to be a very nice solution.</p>
  
  <p>Is there a better way doing this?</p>
  
  <p>Thanks in advance!</p>