I’m quite unsure about what is your question. Usually, we take the last hidden states(output) and apply a linear transformation on it to change to the output shape. Basically, you want to change the shape of last step [B, H] to [B, O], where H is the hidden  size of lstm and O is the number of output class.