You don’t need to flat your data. LSTM can consume your 3d data.
See https://gist.github.com/lochbrunner/d9c77c3fbfd5301154c070561e294ed7#file-bieber_lstm-py-L129 9
Where x is the 3d data. of dimension batch_size x sequence_length x embedding_dim