How to index a list with a TensorFlow tensor?
<p>Assume a list with non concatenable objects which needs to be accessed via a look up table. So the list index will be a tensor object but this is not possible.</p>

<pre><code> tf_look_up = tf.constant(np.array([3, 2, 1, 0, 4]))
 index = tf.constant(2)
 list = [0,1,2,3,4]

 target = list[tf_look_up[index]]
</code></pre>

<p>This will bring out the following error message. </p>

<pre><code> TypeError: list indices must be integers or slices, not Tensor
</code></pre>

<p>Is the a way/workaround to index lists with tensors?</p>