I’m don’t quite understand your question regarding the recalculation of the dimensions of each cell.
Have a look at my code of an LSTM/GRU-based autoencoder 3 to see if that helps. The relevant snippets is probably the _flatten_hidden() method of the encoder and the _unflatten_hidden() method of the decoder.