tensorflow: LSTMBlockFusedCell does not support using DropoutWrapper
I am trying to use DropoutWrapper with LSTMBlockFusedCell as follows:
cell = tf.contrib.rnn.LSTMBlockFusedCell(num_units,forget_bias)
cell = tf.contrib.rnn.DropoutWrapper(cell,dropout)
I get an exception that the LSTMBlockFusedCell is not an RNNCell Message: The parameter cell is not a RNNCell. Which is raised form _like_rnncell during DropoutWrapper initialization.
It is checking for those proprieties on the cell: ““Checks that a given object is an RNNCell by using duck typing.””" conditions = [hasattr(cell, “output_size”), hasattr(cell, “state_size”), hasattr(cell, “zero_state”), callable(cell)] LSTMBlockFusedCell does not have output_size , state_size or zero_state properties.
Should LSTMBlockFusedCell act like RNNCell to allow using various wrappers?
https://stackoverflow.com/questions/46699985/using-tensorflow-dropoutwrapper-with-lstmblockfusedcell
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 11
- Comments: 16 (13 by maintainers)
Unfortunately, because this is cell is fused in time, adding dropout would require modifying the C++ code that performs the computation to add proper random number generation and dropout. Work in this direction is not planned at the moment but I’ll ping @ekelsen to get his thoughts on feasibility.
What about MultiRNNCell ? I believe this was the whole point of DropoutWraper, so that higher level functions accepting rnn cells can be used.
I agree with @godefv the workaround is ok for dropout wrapper, but you cannot still use it MultiRNNCell and dynamic_rnn
You’re right. This should be sufficiently easy, by adding new input_keep_prob and variational_recurrent args to the constructor. If someone is interested in adding this, I’m happy to review the PR.
On Wed, Dec 6, 2017 at 4:41 PM, xiaoyun wu notifications@github.com wrote: