title: Tensorflow transform tensor with vector lookups
body: <p>Given a fixed dictionary with unique keys and values (all numbers are non-negative integers):</p>
  
  <pre><code>d = {(1,3): 6, (5,4): 9}
  </code></pre>
  
  <p>what would be an efficient way in tensorflow to transform:</p>
  
  <pre><code>tf.constant([[1,3], [5,4], [1,3]]) -&gt; tf.constant([6, 9, 6])
  </code></pre>
  
  <p>and vice versa:</p>
  
  <pre><code>tf.constant([6, 9, 6]) -&gt; tf.constant([[1,3], [5,4], [1,3]])
  </code></pre>