TypeError: softmax() got an unexpected keyword argument 'axis'
程序员文章站
2022-05-27 12:39:59
...
win下的环境为keras2.16,运行lstm时报错
TypeError: softmax() got an unexpected keyword argument 'axis'
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-7-ec539a8d38d4> in <module>()
7
8 model.add(Dropout(0.2))#随机失活,避免过拟合,在训练的时候
----> 9 model.add(Dense(y.shape[1],activation="softmax"))#稠密层中定义**函数,整体是一个softmax层,
10 ####待查softmax层的原理,softmax的keras实现,
11 #y.shape[1]是词典长度,activation是**函数,Dense(y.shape[1],activation="softmax")是一个输出层,
解决方案:回退keras版本
keras 2.1.6的softmax没有axis这个参数了,于是,我回退了keras版本:
pip uninstall Keras
pip install keras==2.1
问题解决
上一篇: linux 系统mysql数据库操作
下一篇: Linux系统部署MySQL数据库
推荐阅读
-
报错解决Python Error fix-TypeError: _mean() got an unexpected keyword argument ‘dim‘
-
login() got an unexpected keyword argument 'extra_context'
-
TypeError: softmax() got an unexpected keyword argument 'axis' 解决办法
-
Django报错:TypeError: render() got an unexpected keyword argument 'renderer'
-
TypeError: login() got an unexpected keyword argument 'template_name'
-
TypeError: filter() got an unexpected keyword argument
-
解决 报错 TypeError: interleave() got an unexpected keyword argument ‘deterministic‘
-
TypeError: __init__() got an unexpected keyword argument 'shape'
-
Django TypeError: render() got an unexpected keyword argument 'renderer'
-
TypeError: got an unexpected keyword argument ‘id‘