Solved by richard in post #2 
              
              
                In the case you have you could do 
t[torch.arange(t.size(0)), i]

but I think you’re trying to ask for something more general. How do you want to undo the padding from a GRU output?