Hi @BlueWolf90. From the programming perspective, when you do
r_out = r_out.view(-1, self.hidden_dim)

you are concatenating the output of all steps, which causes the shape mismatch.
From the project’s perspective, the last step output encodes the “information” from previous steps, which is sufficient to predict the next step for most of applications. However, for some applications, it might not be the case. I believe it is a good practice to try using a weighted sum of all previous steps’ outputs (this is a simple way to apply attention mechanism). And use validation dataset to find out which is better.