You’ll need to view the output before sending it to the linear layer (batch will be seq*batch for linear layer) like in the world language example. https://github.com/pytorch/examples/blob/master/word_language_model/model.py 596