title: Sort a tensor and return the sorted index?
body: <p>I would like to sort a tensor on a specific dimension and return a tensor of the same dimension that specifies the sorted index of each element. It seems that tf.nn.top_k can return the sorted indices but how to I map it back?</p>
  
  <pre><code>input = [[10, 3, 1], [5, 6, 2], [1, 7, 10]]
  _, indices = tf.nn.top_k(input, k=3, sorted=True)
  indices = [[0, 1, 2], [1, 0, 2], [2, 0, 1]]
  </code></pre>
  
  <p>What I hope to get is</p>
  
  <pre><code>reordered = [[0, 1, 2], [1, 0, 2], [2, 1, 0]]
  </code></pre>