As you seem you go for a basic classification task, I would do the following
Use the only the last hidden state, and not out which gives you the hidden states of each time step
out, h = self.rnn(x, h_0)

h will have a shape of (num_layers * num_directions, batch, hidden_size), but since you don’t use a bidirectional RNN, it’s just (num_layers, batch, hidden_size) So to get the hidden state if the last layer you just need
h = h[-1]  # Consider only the last layer

Now the shape of h is (batch, hidden_size). Usually you now push this through at least one linear layer, say, self.fc = nn.Linear(hidden_size, num_classes:
output = self.fc(h)

output will have the shape (batch, num_classes), what is most likely what you want.
You probably still have to fix
x.view(x.size(0), self.sequence_length, self.input_size)

using permute() or transpose()