deepcode:

rnn_features, (hidden,_) = self.lstm(packed)


rnn_features are all output tensors of your sequence, so rnn_features shape is (batch_size, sequence_length, output_size). If you wanna get last output, you should use last_output = rnn_features[:, -1, :]