title: Indexing a multi-dimensional tensor with a tensor in PyTorch
body: <p>I have the following code:</p>
  
  <pre><code>a = torch.randint(0,10,[3,3,3,3])
  b = torch.LongTensor([1,1,1,1])
  </code></pre>
  
  <p>I have a multi-dimensional index <code>b</code> and want to use it to select a single cell in <code>a</code>. If b wasn't a tensor, I could do:</p>
  
  <pre><code>a[1,1,1,1]
  </code></pre>
  
  <p>Which returns the correct cell, but:</p>
  
  <pre><code>a[b]
  </code></pre>
  
  <p>Doesn't work, because it just selects <code>a[1]</code> four times.</p>
  
  <p>How can I do this? Thanks</p>