【问题标题】:TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations' In Jupyter AzureTypeError:while_loop() 在 Jupyter Azure 中得到了一个意外的关键字参数“maximum_iterations”
【发布时间】:2019-01-05 11:32:17
【问题描述】:

我正在 Azure 中设置我的循环神经网络:

model = Sequential()


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

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

但我得到了错误:

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

我不是白痴,但我相信我可能正在做一些现在在当前版本的 TensorFlow 和 Keras 中贬值的事情,如在 this 示例中发生了类似的错误并指出了此类错误。我在 Jupyter Azure 平台中使用 Python 3.6,这也意味着我不确定我使用的是什么版本的 Keras 和 TensoFlow。

我的完整回溯错误信息是:

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'

我还从this 教程中了解到WARNING:tensorflow:From keep_dims is deprecated, use keepdims instead。如果这是有效的,我该怎么做?

这可能很简单,但我很困惑,非常感谢您的帮助。

【问题讨论】:

    标签: python azure tensorflow keras jupyter-notebook


    【解决方案1】:
    !pip uninstall keras
    !pip install keras==2.1.2
    

    现在它可以工作了

    【讨论】:

      猜你喜欢
      • 2021-05-14
      • 2016-09-17
      • 2015-06-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-13
      • 2021-03-17
      • 2020-10-01
      相关资源
      最近更新 更多