TypeError: softmax() got an unexpected keyword argument 'axis'

网友投稿 1240 2022-08-23

TypeError: softmax() got an unexpected keyword argument 'axis'

TypeError: softmax() got an unexpected keyword argument 'axis'

今天我装了tensorflow-gpu 1.4, keras 2.1.6发现运行keras模型的时候出现了以下的错误:、

Traceback (most recent call last): File "models.py", line 24, in model = NIH() File "models.py", line 19, in NIH model.add(Activation('softmax')) File "/home/eric/anaconda3/lib/python3.6/site-packages/keras/models.py", line 522, in add output_tensor = layer(self.outputs[0]) File "/home/eric/anaconda3/lib/python3.6/site-packages/keras/engine/topology.py", line 619, in __call__ output = self.call(inputs, **kwargs) File "/home/eric/anaconda3/lib/python3.6/site-packages/keras/layers/core.py", line 304, in call return self.activation(inputs) File "/home/eric/anaconda3/lib/python3.6/site-packages/keras/activations.py", line 29, in softmax return K.softmax(x) File "/home/eric/anaconda3/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2963, in softmax return tf.nn.softmax(x, axis=axis)TypeError: softmax() got an unexpected keyword argument 'axis'

就网上说是keras 2.1.6的softmax没有axis这个参数了,于是,我回退了keras版本:

pip install keras==2.1

然后程序就不报错误了,完工。

参考文献

[1].TypeError: softmax() got an unexpected keyword argument 'axis'.https://github.com/keras-team/keras/issues/9621

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:python3读取excel文件只提取某些行某些列的值
下一篇:could not create cudnn handle: CUDNN_STATUS_NOT_INITIALIZED
相关文章

 发表评论

暂时没有评论,来抢沙发吧~