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's state_is_tuple doesn't work with initial_state #2695
Comments
When you use
Note that it is applicable only for simple RNNs without stacked layers; for a multi-layer case, check out my modification of the RNN PTB example: https://github.com/jihunchoi/tensorflow/blob/ptb_use_state_tuple/tensorflow/models/rnn/ptb/ptb_word_lm.py. |
Thank you for the example, it did work and it is indeed faster :) |
This may be something we're working on. Would you like to open a new bug to track it, explicitly describing the semantics of how you'd like to be able to pass tuples into feed_dict? Closing this bug for now. Thanks for answering @jihunchoi! |
Sorry to comment on this closed issue, but I came across the exact same problem when trying to get rid of the 'state_is_tuple' warning. The usage of the tuple-less state was very nice and manageable (at least for the basic stuff I was doing), passing in and out a single tensor. With the tuple state, if I have a variable number of cells (e.g. trying different hyperparameters), the code becomes a bit more ugly. I wrote something like this below, which returns a dict which I can use for feeding into the initial state. But then the final state also becomes a problem, and I'm not sure what the best way to manage this dynamically is. is this really the best way?
|
just a follow up on this. I think I have it fully working now (tested a small model). For a Graves-style sequence generation it took quite a bit of wrangling. This was the original code (relevant bits only) without tuples
and this is what it took (relevant bits only) to get it working with tuples, it would be great to wrap this up somehow, and make it easier:
|
Hi , there are a |
Assuming I want to batch series of inputs and propagate the cell state from one session run towards another for an epoch:
Since using state_is_tuple in the cells makes the state be a tuple on return:
The text was updated successfully, but these errors were encountered: