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

Decoder Initial State and Input #5

Open
shubhamagarwal003 opened this issue Feb 17, 2018 · 1 comment
Open

Decoder Initial State and Input #5

shubhamagarwal003 opened this issue Feb 17, 2018 · 1 comment

Comments

@shubhamagarwal003
Copy link

shubhamagarwal003 commented Feb 17, 2018

Hi @RobRomijnders ,
Thanks for sharing your code. I am very new to RNNs so forgive me for a silly question. In your decoder I am a little confused about the inputs and initial state. Shouldn't the input be the one obtained from the encoder (the latent space)? It seems in your code

initial_state_dec = tuple([(z_state, z_state)] * num_layers)
dec_inputs = [tf.zeros([batch_size, 1])] * sl 
outputs_dec, _ = tf.contrib.rnn.static_rnn(cell_dec, inputs=dec_inputs,
                                                       initial_state=initial_state_dec)

the initial state is obtained from the encoder and not the inputs? So if you could please explain me the reason for that?

@tejaslodaya
Copy link

Hi @shubhamagarwal003 ,
I know its really late for the answer. But if anyone comes here and is stumbled upon the same question, it may be of some help.

In the section Lat_2_dec, latent_vector (z_mu) is passed through a linear layer to obtain z_state.
Now, z_state is of hidden_size dimension, which serves as an initial hidden layer in the decoder.
That's what initial_state_dec is meant by.

And for the inputs for the decoder, they're initialized by zeros, given by dec_inputs.
So, we have inputs and hidden of a decoder.

Let me know if you have any questions.

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

2 participants