TypeError: __init__() takes at least 4 arguments (4 given)
2017-08-23 21:30
3611 查看
在添加卷积层的过程中,会出现如标题所示的错误 TypeError: init() takes at least 4 arguments (4 given),可能的原因:keras的版本与命令或参数不一致,或者 kears 和 theano 版本不匹配。
假如当前的keras版本是 2.0.1,添加卷积层的过程中,其中有一个超参数 border_mode,但却使用了 1.0.8 版本中的 padding 时,就会出现如上所示的错误,建议:
1、对照 keras 文档,调整命令和参数。fchollet/keras,该链接中详细列举了各个keras版本中有哪些参数发生了调整。
2、cmd 进入控制台,使用 conda list 查看当前keras版本,进行升级。注意:把当前版本的 keras 和 theano 一同卸载,全部重新安装新版本,否则仍旧报错,如 TypeError: pool_2d() got an unexpected keyword argument ‘ws’.使用 “pip install keras==版本号” 安装 keras 时,自动检测相匹配的 theano 版本,安装即可。
假如当前的keras版本是 2.0.1,添加卷积层的过程中,其中有一个超参数 border_mode,但却使用了 1.0.8 版本中的 padding 时,就会出现如上所示的错误,建议:
1、对照 keras 文档,调整命令和参数。fchollet/keras,该链接中详细列举了各个keras版本中有哪些参数发生了调整。
2、cmd 进入控制台,使用 conda list 查看当前keras版本,进行升级。注意:把当前版本的 keras 和 theano 一同卸载,全部重新安装新版本,否则仍旧报错,如 TypeError: pool_2d() got an unexpected keyword argument ‘ws’.使用 “pip install keras==版本号” 安装 keras 时,自动检测相匹配的 theano 版本,安装即可。
相关文章推荐
- MonkeyRunner_TypeError: __init__() takes at least 3 arguments (2 given)
- TypeError: resize_images() takes at least 3 arguments (3 given)
- TypeError: __init__() takes exactly 2 arguments (1 given)(已解决)
- module._init_() takes at most 2 arguments (3 given) (scrapy tutorial w/ xpath)
- TypeError: add_or_update() takes at most 3 arguments (4 given)
- Type error create_engine() take at least 3 arguments (3 given)
- TypeError: print_space() takes exactly 2 arguments (3 given)
- TypeError: __init__() takes exactly 2 arguments (3 given)
- AddType requires at least two arguments, a mime type followed by one or more file extensions
- TypeError: __init__() missing 1 required positional argument: 'on_delete'
- TypeError: not all arguments converted during string formatting
- python安装pbkdf2 遇到错误TypeError: __call__() takes exactly 2 arguments (1 given)
- TypeError: download_html() takes exactly 2 arguments (3 given)
- python 使用装饰器提示:TypeError: wrapper() takes no arguments (1 given)
- AddType requires at least two arguments, a mime type followed by one or more file extensions
- Find a number in the array having least difference with the given number (n)
- ORA-48108: invalid value given for the diagnostic_dest init.ora parameter
- Spring AOP - Caused by: java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
- Bug: _run_validation_chain validator(form, self) TypeError: __init__() takes at most 2 arguments (3
- Spring AOP - Caused by: java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given