You can use a linear layer on the output of the RNN to get whatever output dimension you want. That’s exactly what the implementation of an LSTM or GRU cell would have done if it would have provided an output_size argument.