In several tutorials on n-gram language models (e.g. this 1) the output of LSTM is stacked:
out ,_=lstm(input)
out = out.contiguous().view(-1, self.n_hidden)


which is dimensionality (batch_size*seq_length, hidden_features) and becomes the input in the next layer. Target is also resized to batch_size*seq_length.
I don’t understand this approach as it’s the job of LSTM to learn the relationship among inputs in the sequence. The correct output should be
out,_ = lstm(input)
out = out[:,-1,:]

the last state for each batch, and become the  input in the next layer, and the target is size batch_size.
So why use the full sequence then?