Assume that the list is not associated with concatenable objects that must be accessed through the lookup table. Thus, the list index will be a tensor object, but this is not possible.
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]]
The following error message appears.
TypeError: list indices must be integers or slices, not Tensor
Is there a way / workaround to index lists with tensors?
source share