In fact I’m trying to (re)implement keras’s text generation example 64 with PyTorch. In keras’s Recurrent layers, there is


return_sequences: Boolean. Whether to return the last output in the output sequence, or the full sequence.

and in the example, this is false, so I think taking only the last output is needed.