I think I got the idea of input_lengths for pack_padded_sequence by following this gist 10. It is the number of non-zero sequences in a batch. In my case, the number can go up to 48 which is the maximum number of sequences in a batch.