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

Hope intermediate state in dynamic_rnn #5731

Closed
Sraw opened this issue Nov 20, 2016 · 6 comments
Closed

Hope intermediate state in dynamic_rnn #5731

Sraw opened this issue Nov 20, 2016 · 6 comments
Assignees
Labels
type:feature Feature requests

Comments

@Sraw
Copy link

Sraw commented Nov 20, 2016

To implement a attention machine, I need the intermediate state to calculate the attention, but dynamic_rnn doesn't return the intermediate states but only final state.
Hope the dynamic_rnn could return intermediate states so that we can implement a attention machine with dynamic network.

@ebrevdo
Copy link
Contributor

ebrevdo commented Nov 22, 2016

You can write a variant of the LSTMCell that returns both state tensors as part of the output, if you need both c and h state for each time step. If you just need the h state, that's the output of reach time step.

@ebrevdo ebrevdo closed this as completed Nov 22, 2016
@Sraw
Copy link
Author

Sraw commented Nov 23, 2016

@ebrevdo Thanks for reply. Really helpful.

@aselle aselle added type:feature Feature requests and removed enhancement labels Feb 9, 2017
@WolfNiu
Copy link

WolfNiu commented Feb 21, 2017

@ebrevdo May I ask a question? For each time step of LSTM there is a memory cell value c, a hidden state h, and an output y. So what you were suggesting is that the outputs returned by dynamic RNN contain h rather than y for each step? Would that also mean the returned output_states is actually outputs[-1]? Thank you.

@Sraw
Copy link
Author

Sraw commented Feb 22, 2017

@WolfNiu I can answer your question.
http://colah.github.io/posts/2015-08-Understanding-LSTMs/
if you look into the structure of LSTM, you will see that the hidden state h and the output y is the same, they all come from the same line.
So actually, there are only two values at each step, h or y and c.

@evanthebouncy
Copy link

@ebrevdo

I tried your suggestion but I ran into such trouble doing it, can you take a look at my stackoverflow post?

https://stackoverflow.com/questions/45528146/tensorflow-create-a-custom-sub-class-of-lstm-cell-with-a-dfferent-call-functi

Thanks

@ghost
Copy link

ghost commented Sep 4, 2017

@Sraw am I able to assign specific values for lstm gates? for instance always 1 for input and....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature Feature requests
Projects
None yet
Development

No branches or pull requests

6 participants