venkatasg:

return unpacked.gather(1, idx).squeeze()


I do not know if this is correct but i think squeeze() here should be done by time dimension which is 1 when batch_first=True. Another thing i notices is that you do not pass lengths to pack_padded_sequence which does not make much sense to me.
I have the same issue actually. Dont know how to solve it yet.