TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations' In Jupyter Azure

感情迁移 提交于 2019-12-12 13:18:45

问题


I am setting up my recurrent neural network in Azure:

model = Sequential()


model.add(GRU(units=512,
                return_sequences=True,
                input_shape=(None, x1,)))

  model.add(Dense(y1, activation='sigmoid'))

But I am getting the error:

TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations'

I am not cretin but I believe I may be doing something that is now depreciated in current versions of TensorFlow & Keras, as in this example a similar error has occurred and such errors were pointed out. I am using Python 3.6 in the Jupyter Azure platform which also means I am unsure as to what version of Keras and TensoFlow I am using.

My full tracback error message is:

TypeError                                 Traceback (most recent call last)
<ipython-input-7-e6bcba2d0346> in <module>()
    205 model.add(GRU(units=512, return_sequences=True,
--> 207                 input_shape=(None,x1,)))
    208 

~/anaconda3_501/lib/python3.6/site-packages/keras/engine/sequential.py in add(self, layer)
    164                     # and create the node connecting the current layer
    165                     # to the input layer we just created.
--> 166                     layer(x)
    167                     set_inputs = True
    168                 else:

~/anaconda3_501/lib/python3.6/site-packages/keras/layers/recurrent.py in __call__(self, inputs, initial_state, constants, **kwargs)
    498 
    499         if initial_state is None and constants is None:
--> 500             return super(RNN, self).__call__(inputs, **kwargs)
    501 
    502         # If any of `initial_state` or `constants` are specified and are Keras

~/anaconda3_501/lib/python3.6/site-packages/keras/engine/base_layer.py in __call__(self, inputs, **kwargs)
    458             # Actually call the layer,
    459             # collecting output(s), mask(s), and shape(s).
--> 460             output = self.call(inputs, **kwargs)
    461             output_mask = self.compute_mask(inputs, previous_mask)
    462 

~/anaconda3_501/lib/python3.6/site-packages/keras/layers/recurrent.py in call(self, inputs, mask, training, initial_state)
   1587                                      mask=mask,
   1588                                      training=training,
-> 1589                                      initial_state=initial_state)
   1590 
   1591     @property

~/anaconda3_501/lib/python3.6/site-packages/keras/layers/recurrent.py in call(self, inputs, mask, training, initial_state, constants)
    607                                              mask=mask,
    608                                              unroll=self.unroll,
--> 609                                              input_length=timesteps)
    610         if self.stateful:
    611             updates = []

~/anaconda3_501/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py in rnn(step_function, inputs, initial_states, go_backwards, mask, constants, unroll, input_length)
   2955             parallel_iterations=32,
   2956             swap_memory=True,
-> 2957             maximum_iterations=input_length)
   2958         last_time = final_outputs[0]
   2959         output_ta = final_outputs[1]

TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations'

I have also learned from this tutorial that WARNING:tensorflow:From keep_dims is deprecated, use keepdims instead. If this is valid, how could I do this?

This maybe something quite straight forward but I am quite confused, Help with this would be really appreciated.


回答1:


!pip uninstall keras
!pip install keras==2.1.2

And now it works



来源:https://stackoverflow.com/questions/51573241/typeerror-while-loop-got-an-unexpected-keyword-argument-maximum-iterations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!