Example of Many-to-One LSTM


Recurrent modules from torch.nn will get an input sequence and output a sequence of the same length. Just take the last element from that output sequence.


This reply by @Tudor_Berariu  on the topic of Many-to-One LSTMs relates closely to what I’m trying to do. But how do I “Just take the last element from that output sequence.” when my input batch is a PackedSequence of samples of variable length (in terms of time-steps)?