I think it depends on your use case.
Currently you are feeding a tensor with the shape [seq_len, batch_size, hidden_size] into your linear layer.
Usually the input to a linear layer should be [batch_size, *, in_features]. The * means any number of additional dimensions, where the same linear operation will be performed on.
In this case, your output won’t differ, but will be shaped [seq_len, batch_size, out_features].
Since your target is most likely in the shape [batch_size, *], you’ll get an error trying to calculate the loss.
You could permute the output or the activation in your model to set the batch dimension as dim0.
In case your target is only a single class for the whole sequence, probably you would like to get the activation of the last step from your LSTM.