Solved by yonti in post #2 
              
              
                short answer: 
before using pack_padded_sequence you need to sort the inputs by length and pass that to the function. 
sorting will return the permutation index and you can use that to permute your output 
x = ['aaa', 'bbbb', 'cc']
lengths = torch.tensor([3,  4, 2])
lengths_permuted, perm_index = le…