title: Impact of the parameter dimension in gather function
body: <p>I am trying to use the <a href="http://pytorch.org/docs/master/torch.html?highlight=gather#torch.gather" rel="nofollow noreferrer">gather</a> function in pytorch but can't understand the role of <code>dim</code> parameter.</p>
  
  <p>Code:</p>
  
  <pre><code>t = torch.Tensor([[1,2],[3,4]])
  print(torch.gather(t, 0, torch.LongTensor([[0,0],[1,0]])))
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code> 1  2
   3  2
  [torch.FloatTensor of size 2x2]
  </code></pre>
  
  <p>Dimension set to 1:</p>
  
  <pre><code>print(torch.gather(t, 1, torch.LongTensor([[0,0],[1,0]])))
  </code></pre>
  
  <p>Output becomes:</p>
  
  <pre><code> 1  1
   4  3
  [torch.FloatTensor of size 2x2]
  </code></pre>
  
  <p>How, <code>gather</code> function actually works?</p>