How can I feed a batch into LSTM without reordering them by length in PyTorch?
I am new to Pytorch and I have got into some trouble.
I want to build a rank-model to judge the similarity of question and its answers (including right answers and wrong answers). And I use LSTM as an encoder. 

There are two LSTMs in my model and they share the weights. So my model’s input is two sequences (question and answer). But if I use batch, reordering will disrupt the correspondence between questions and answers.
What should I do?

Maybe a starting point could be to use similar RNN wrapper as here https://github.com/facebookresearch/DrQA/blob/master/drqa/reader/layers.py#L20 
You can encode question and asnwer separately (this module will pack and unpack internally and will take care of sorting) and then you can work on the encoded representations
