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

run error #3

Open
Handwolf opened this issue Jul 21, 2020 · 1 comment
Open

run error #3

Handwolf opened this issue Jul 21, 2020 · 1 comment

Comments

@Handwolf
Copy link

Handwolf commented Jul 21, 2020

Hello ! I am a student from China and I am learning about ESN recently. I have read your ESN code on github.But when I tried to reproduce the code myself(on tensorflow2), I found the following error. Could you tell me what the reason is?

filename:ESN-usage
code:
model = keras.models.Sequential()
model.add(recurrent_layer)
model.add(output)

TypeError: You are attempting to use Python control flow in a layer that was not declared to be dynamic. Pass dynamic=True to the class constructor.
Encountered error:
"""
using a tf.Tensor as a Python bool is not allowed in Graph execution. Use Eager execution or decorate this function with @tf.function.
"""

@JordanMajd
Copy link

Try adding dynamic=True to the RNN constructor:

recurrent_layer = tf.keras.layers.RNN(esn_cell, return_sequences=True, name="rnn", dynamic=True)

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

2 participants