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

rnn_decoder initial_state #21

Open
bwang482 opened this issue Oct 29, 2016 · 2 comments
Open

rnn_decoder initial_state #21

bwang482 opened this issue Oct 29, 2016 · 2 comments

Comments

@bwang482
Copy link

bwang482 commented Oct 29, 2016

Thanks so much for your code hunkim! It is very helpful!

Can I ask a quick question please? Am I right to think: within one batch, every time you feed model.initial_state: state to model, it overrides
self.initial_state = cell.zero_state(args.batch_size, tf.float32) (because this zero_state initialisation is also in model def__init__() thus I am not too sure whether it can be overriden )?

Thanks!

@sunxiaobiu
Copy link

sunxiaobiu commented Nov 27, 2016

The value of initial_state is updated after processing each batch of words:
outputs, last_state = seq2seq.rnn_decoder(inputs, self.initial_state, cell, loop_function=loop if infer else None, scope='rnnlm')
the zero_state model def__init__() is to initiliaze the state of the memory.
the last_state hold the state of the memory after each batch of words.

@Songweiping
Copy link

Hi @sunxiaobiu @hunkim, I am confused with initial_state, too.
After a batch, you feed feed[c]=state[i].c, feed[h]=state[i].h to model. Does this mean using last state of last batch as initial state of current batch? In outputs,last_state = seq2seq.rnn_decoder(inputs, self.initial_state, cell, loop_function=loop if infer else None, scope='rnnlm', self.initial_state would not be zero_state after first batch, am I right?
Thanks!

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

3 participants