title: Convert an input string tensor to python string
body: <p>I have two dictionaries below:</p>
  
  <pre><code>word2int = {}
  int2word = {}
  
  for i,word in enumerate(words):
      word2int[word] = i
      int2word[i] = word
  
  def euclidean_dist(vec1, vec2):
      return np.sqrt(np.sum((vec1-vec2)**2))
  
  def find_closest(word_index, vectors):
      min_dist = 10000 # to act like positive infinity
      min_index = -1
      query_vector = vectors[word_index]
      for index, vector in enumerate(vectors):
          if euclidean_dist(vector, query_vector) &lt; min_dist and not np.array_equal(vector, query_vector):
              min_dist = euclidean_dist(vector, query_vector)
              min_index = index
      return min_index
  </code></pre>
  
  <p>I have an input string tensor <code>X</code>.  I would like to use <code>X</code> an index in <code>word2int</code> as shown below:</p>
  
  <pre><code>X = tf.placeholder(tf.string)
  find_closest_word = tf.convert_to_tensor(int2word[find_closest(word2int[X], vectors)], dtype=tf.string)
  </code></pre>
  
  <h3>Question:</h3>
  
  <p>How can I convert a string tensor <code>X</code> to a python string so that it can be used as index in word2int?</p>