I have a tensor probs which has shape (None, None, 110) representing (batch_size, sequence_length, 110) in an LSTM.
I have another tensor indices which has shape (None, None), which contains the indices of the elements to select from the third dimension of probs.
I want to use indices to index the tensor probs.
Numpy equivalent:
k, j = np.meshgrid(np.arange(probs.shape[1]), np.arange(probs.shape[0]))
indexed_probs = probs[j, k, indices]
Since shape[0] and shape[1] of probs is not known, tf.meshgrid() is not an option.
I found tf.gather, tf.gather_nd and tf.batch_gather, but they all don't seem to do what I want.
Does anybody know how to do this?