title: How can I assign a list to a torch.tensor?
body: <p>Assume that I have a list <code>[(0,0),(1,0),(1,1)]</code> and another list <code>[4,5,6]</code> and a matrix X with size is (3,2). I am trying to assign the list to the matrix like <code>X[0,0] = 4</code>, <code>X[1,0] = 5</code> and <code>X[1,1] = 6</code>. But it seems like I have a problem of assigning a list to tensor</p>
  <pre><code>x = torch.zeros(3,2)
  indices = [(0,0),(1,0),(1,1)]
  value = [4,5,6]
  x[indices] = values
  </code></pre>
  <p>Error:</p>
  <pre><code>TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-7-dec4e6a479a5&gt; in &lt;module&gt;
       
     4 indices = [(0, 0), (1, 0), (1, 1)]
   
     5 values = [4, 5, 6]
  
  ----&gt; 6 x[indices] = values
  
  TypeError: can't assign a list to a torch.FloatTensor
  </code></pre>