Thanks for highlighting the problem! I encounter the same problem as well. In fact I created a thread in this forum to ask about the problem and I didn’t know that the pack_padded_sequence is the culprit. Once I removed that, the model is learning well!
Correction:
The problem does not lies with the pack_padded_sequence, but with the problem madsxcva has said. When I sort my x tensor, I didn’t apply the same sorting seq to y tensor so the training is not correct!