It gathers slices of select indices (selector) from input with respect to the specified axis. A workaround I found is input[:, :, selector, :] which returns the same output as tf.gather(input, selector, axis=2). However, how do I do the same thing if the shape of input is not known? Here are some more examples:
tf.gather(input, selector, axis=0) is the same as input[selector, ...]
tf.gather(input, selector, axis=1) is the same as input[:, selector, ...]
tf.gather(input, selector, axis=2) is the same as input[..., selector, :]
tf.gather(input, selector, axis=3) is the same as input[..., selector]