title: How to generate indices like [0,2,4,1,3,5] without using explicit loop for reorganizing rows of a tensors in Pytorch?
body: <p>Suppose I have a Tensor like</p>
  <pre><code>a = torch.tensor([[3, 1, 5, 0, 4, 2],
                    [2, 1, 3, 4, 5, 0],
                    [0, 4, 5, 1, 2, 3],
                    [3, 1, 4, 5, 0, 2],
                    [3, 5, 4, 2, 0, 1],
                    [5, 3, 0, 4, 1, 2]])
  </code></pre>
  <p>and I want to reorganize the rows of the tensor by applying the transformation <code>a[c]</code> where</p>
  <pre><code>c = torch.tensor([0,2,4,1,3,5])
  </code></pre>
  <p>to get</p>
  <pre><code>b = torch.tensor([[3, 1, 5, 0, 4, 2],
                    [0, 4, 5, 1, 2, 3],
                    [3, 5, 4, 2, 0, 1],
                    [2, 1, 3, 4, 5, 0],
                    [3, 1, 4, 5, 0, 2],
                    [5, 3, 0, 4, 1, 2]])
  </code></pre>
  <p>For doing it, I want to generate the tensor <code>c</code> so that I can do this transformation irrespective of the size of tensor a and the stepping size (which I have taken to be equal to 2 in this example for simplicity). Can anyone let me know how do I generate such a tensor for the general case without using an explicit for loop in PyTorch?</p>