title: tesorflow sort using top_k and any way
body: <p>I'm tensorflow beginner.I want to know how to sort the list.</p>
  <p>For example
  [['s1',1],['s2',3],['s3',2]] &lt;--from this list
  Can I sort the first index in each list and get the zeroth index value in the sorted list?</p>
  <p>[['s1',1],['s3',2],['s2',3]]</p>
  <p>print In turn
  sess.run(...) #'s1,s3,s2'</p>
  <p>★★★</p>
  <blockquote>
  <p>s_name and number are tensor.</p>
  <p>s_name=tf.constant(,dtype=tf.string) # Read from csv file.</p>
  <p>number=The value was obtained using placeholder</p>
  </blockquote>
  <h1>try:</h1>
  <p>i used 'dic'</p>
  <pre><code>dic={}
  dic[s_name]=number (number=1,2,3)
  </code></pre>
  <p>print dic</p>
  <pre><code>{1:&quot;s1&quot;,3:&quot;s2&quot;,2:&quot;s3&quot;}
  </code></pre>
  <p>and i used 'top_k'</p>
  <pre><code>dic_key=dic.keys()
  
  sort_distance=tf.nn.top_k(dic_key, k=3,sorted=True).values
  reverse_distance=tf.reverse(sort_distance,axis=[0])
  
  session.run(reverse_distance) #print '1,2,3'
  </code></pre>
  <p>This will sort the numbers, but I do not know how to get the s_name corresponding to a number.</p>
  <p>Is there any way?
  It is not necessarily a list.
  Each <code>s_name</code> has a number. I want to sort by numbers and get s_name with sorted numbers.</p>