S.Mandal
S.Mandal

Reputation: 181

Add more layers in seq2seq model

In the sample seq2seq code given by fchollet, how can I add more LSTM layers to the encoder and decoder? I'm having some trouble with the shapes and a bit confused in general. Thanks.

Upvotes: 3

Views: 762

Answers (1)

Primusa
Primusa

Reputation: 13498

Keras' functional api lets you call layers. This lets you chain another layer on top the output of an existing layer by calling it. For example here:

encoder_inputs = Input(shape=(None, num_encoder_tokens))
encoder = LSTM(latent_dim, return_sequences=True)
encoder_outputs, state_h, state_c = LSTM(latent_dim, return_state=True)(encoder(encoder_inputs))

Upvotes: 4

Related Questions