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

Keras RNN example from docs does not support statefulness when multilayer #28614

Closed
davisyoshida opened this issue May 10, 2019 · 2 comments
Closed
Assignees
Labels
comp:keras Keras related issues stat:awaiting tensorflower Status - Awaiting response from tensorflower TF 1.13 Issues related to TF 1.13 type:bug Bug

Comments

@davisyoshida
Copy link

Please make sure that this is a bug. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow):

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):

  • TensorFlow installed from (source or binary): Binary

  • TensorFlow version (use command below): 1.13.1

  • Python version: 3.6.7 (Anaconda)

  • CUDA/cuDNN version: 9.2/7.3.1

  • GPU model and memory: GTX 1070 Ti

Describe the current behavior
Modifying the example code given here to have stateful=True leads to the following error:

Traceback (most recent call last):
  File "tmp.py", line 6, in <module>
    y = layer(x)
  File "/home/davis/software/anaconda3/envs/p36/lib/python3.6/site-packages/tensorflow/python/keras/layers/recurrent.py", line 701, in __call__                                                                                                                                
    return super(RNN, self).__call__(inputs, **kwargs)
  File "/home/davis/software/anaconda3/envs/p36/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 538, in __call__                                                                                                                               
    self._maybe_build(inputs)
  File "/home/davis/software/anaconda3/envs/p36/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1603, in _maybe_build                                                                                                                          
    self.build(input_shapes)
  File "/home/davis/software/anaconda3/envs/p36/lib/python3.6/site-packages/tensorflow/python/keras/layers/recurrent.py", line 636, in build                                                                                                                                   
    self.reset_states()
  File "/home/davis/software/anaconda3/envs/p36/lib/python3.6/site-packages/tensorflow/python/keras/layers/recurrent.py", line 906, in reset_states                                                                                                                            
    tensor_shape.as_shape(dim).as_list()))
  File "/home/davis/software/anaconda3/envs/p36/lib/python3.6/site-packages/tensorflow/python/keras/backend.py", line 2833, in set_value
    value = np.asarray(value, dtype=dtype(x))
  File "/home/davis/software/anaconda3/envs/p36/lib/python3.6/site-packages/tensorflow/python/keras/backend.py", line 1015, in dtype
    return x.dtype.base_dtype.name
AttributeError: 'list' object has no attribute 'dtype'

Describe the expected behavior
Code should run with no error

Code to reproduce the issue

cells = [tf.keras.layers.LSTMCell(32), tf.keras.layers.LSTMCell(64)]
x = tf.keras.Input(batch_shape=(42, None, 5)) 
layer = tf.keras.layers.RNN(cells, stateful=True)
y = layer(x)
@achandraa achandraa self-assigned this May 13, 2019
@achandraa achandraa added comp:keras Keras related issues TF 1.13 Issues related to TF 1.13 type:support Support issues labels May 13, 2019
@achandraa achandraa assigned ymodak and unassigned achandraa May 13, 2019
@ymodak ymodak assigned qlzh727 and unassigned ymodak May 13, 2019
@ymodak ymodak added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label May 13, 2019
@qlzh727
Copy link
Member

qlzh727 commented May 14, 2019

Thank you for reporting the issue, will fix it soon.

mahak pushed a commit to mahak/tensorflow that referenced this issue May 14, 2019
@qlzh727
Copy link
Member

qlzh727 commented May 14, 2019

This should be now fixed in 1225055.

@qlzh727 qlzh727 closed this as completed May 14, 2019
@ymodak ymodak added type:bug Bug and removed type:support Support issues labels May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:keras Keras related issues stat:awaiting tensorflower Status - Awaiting response from tensorflower TF 1.13 Issues related to TF 1.13 type:bug Bug
Projects
None yet
Development

No branches or pull requests

4 participants