1
votes

I am starting to learn RNNs and trying a SimpleRNN implementation in Keras. Here is my code :

>>> from keras.models import Sequential
>>> from keras.layers import Embedding, SimpleRNN
>>> model = Sequential()
>>> model.add(Embedding(10000, 32))
>>> model.add(SimpleRNN(32))
>>> model.summary()

System throws the following error :

Traceback (most recent call last): File "", line 1, in model.add(SimpleRNN(32)) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/engine/sequential.py", line 187, in add output_tensor = layer(self.outputs[0]) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/layers/recurrent.py", line 500, in call return super(RNN, self).call(inputs, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/engine/base_layer.py", line 460, in call output = self.call(inputs, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/layers/recurrent.py", line 1030, in call initial_state=initial_state) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/layers/recurrent.py", line 609, in call input_length=timesteps) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2957, in rnn maximum_iterations=input_length) TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations'

I am using Python 3.6 and Keras 2.2.0. I have tried several things but unable to resolve. Please help.

Regards Vivek

1
Tyy to reinstall tensorflow. I think there is some version problemixeption

1 Answers

0
votes

I had the same problem with Keras 2.2.0 and Tensorflow 1.8.0

Than I installed the Keras-2.2.0 in accompany with the Tensorflow-1.8.0 for CPU by this command:

conda install -c hesi_m keras

problem solved.

I recommend you to use Anaconda, which makes life easier.

Thanks