Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question about the initial_state of decoder #1

Open
NiFangBaAGe opened this issue Jan 18, 2019 · 0 comments
Open

question about the initial_state of decoder #1

NiFangBaAGe opened this issue Jan 18, 2019 · 0 comments

Comments

@NiFangBaAGe
Copy link

Hi, I am wonder that how to initialize the state of the encoder and decoder. I tried both encoder_states and [a1, b1] to initialize the state of the decoder_lstm2 but got bad result. I can get good results when I use only decoder_lstm1 with one or several encoders which without initialize the state. Could you please help me? Here is my code.

encoder_inputs = Input(shape=(max_video_length, 4096), dtype='float32')
encoder = LSTM(latent_dim, return_state=True)
encoder_outputs, state_h, state_c = encoder(encoder_outputs2)
encoder_states = [state_h, state_c]

decoder_inputs = Input(shape=(None, len(char_list)), name="decoder_inputs")
decoder_lstm1 = LSTM(latent_dim, return_sequences=True, return_state=True, name="decoder_lstm1")
decoder_lstm2 = LSTM(latent_dim, return_sequences=True, return_state=True, name="decoder_lstm2")
decoder_dense = Dense(len(char_list), activation='softmax')

decoder_outputs, a1, b1 = decoder_lstm1(decoder_inputs, initial_state=encoder_states)
decoder_outputs, a2, b2 = decoder_lstm2(decoder_outputs, initial_state=encoder_states)
decoder_outputs = decoder_dense(decoder_outputs)

model = Model([encoder_inputs, decoder_inputs], decoder_outputs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant