title: Access 3D tensor (image) using a 2d tensor of indices
body: <p>With the following 3D tensor representing an image <br>
  <code>img.shape=[H,W,F]</code><br>
  And a tensor representing the indices to that img <br>
  <code>indices.shape=[N,2]</code><br>
  E.g. if <br><code>indices = [[0,1],[5,3],...]]</code>
  I would like to create a new tensor of shape <code>new.shape=[N,F]</code> where <br><code>new[k] == img[indices[k][0],indices[k][1]]</code>
  Currently to solve this I flatten both tensors:</p>
  <pre><code>    idx_flattened = idx_flattened [:,0] * (idx_flattened [:,1].max()+1) + idx_flattened[:,1]
      img = img .reshape(-1,F)
      new = img[idx_flattened ]
  </code></pre>
  <p>But I'm certain there is a better way:)</p>
  <p>Here's a full minimal example:</p>
  <pre><code>img = torch.arange(8*10*3).reshape(8,10,3)
  indices = torch.tensor([[0,0],[3,0],[1,2]])
  new = img[indices] &lt;- This does not work
  new = [[  0,   1,   2],[ 90,  91,  92],[ 36,  37,  38]]
  </code></pre>
  <p>Ideas?</p>