Calculate Dimensions of LSTM/GRUs

My Enc/Dec consists of two cells with decreasing dimenions. Now I’d like to add bidirecitonal functionality and more than 1 layer for each cell → the dimensions of my input changes.

edit: Thank you with your code and some debug session I did understand how the data is transformed. I’ve found an other post from you → For beginners: Do not use view() or reshape() to swap dimensions of tensors!

At the moment I reshape the data, as I understood you recommend to do it otherwise?!