Since you define your LSTM with the default parameter batch_first=False, the output has the shape (seq_len, batch, hidden_size). That means that out[:, -1, :] gives you the values for the hidden states of all the time steps for the last item in your batch, i.e., the output shape is (seq_len, hidden_dim).
What you want is the last hidden state (“last” w.r.t. to the number of time steps) for all items in your batch. You simple change that line to out[-1]. Just to be sure, and since I don’t know how your data looks like, can you change your forward() method as follows, and post the output of the print statements?
def forward(self, x):
    print(x.shape)
    out, _ = self.rnn(x)
    print(out.shape)
    out = out[:, -1, :])
    print(out.shape)
    out = self.out(out)
    return out