title: Index a torch tensor with an array
body: <p>I have the following torch tensor:</p>
  
  <pre><code>tensor([[-0.2,  0.3],
      [-0.5,  0.1],
      [-0.4,  0.2]])
  </code></pre>
  
  <p>and the following numpy array: (I can convert it to something else if necessary)</p>
  
  <pre><code>[1 0 1]
  </code></pre>
  
  <p>I want to get the following tensor:</p>
  
  <pre><code>tensor([0.3, -0.5, 0.2])
  </code></pre>
  
  <p>i.e. I want the numpy array to index each sub-element of my tensor. Preferably without using a loop.</p>
  
  <p>Thanks in advance</p>