If I have a tensor of shape "batch_size * length * hidden_size", and I have another index span tensor of shape "batch_size * 2", where the index span tensor indicates the beginning and ending indices I want to select from the first tensor. Say if the index span tensor has values
[[1,3], [2, 4]]
then I want to get the following mask from the first tensor
[[0, 1, 1, 1, 0, 0, ...], [0, 0, 1, 1, 1, 0, 0, ...]]
Is there a way to do it with Tensorflow?