In the example on the Keras site, seq2seq_translate.py on line 189, there is a LSTM layer after another (the first with
return_sequences=True), but another example lstm_seq2seq.py which does the same thing but letter-by-letter uses only one LSTM in the encoder. My code looks like:
encoder = LSTM(latent_dim, return_sequences=True)(encoder_inputs) encoder_outputs, state_h, state_c = LSTM(latent_dim, return_state=True)(encoder)
My question is why does the word-by-word version use two LSTM layers? And why is the return_sequences used?