python - TypeError: call() 得到了一个意外的关键字参数“input_shape”
问题描述
我正在实现一个 LSTM,我的火车数据的形状是 (5237162, 99, 1)。
我按如下方式创建模型,但遇到错误。
TypeError: call() got an unexpected keyword argument 'input_shape'
我尝试从 github 将 Keras 升级到最新版本。不工作。
LSTM_model = Sequential()
LSTM_model.add(LSTM(256,input_shape=(final_ip.shape[1],final_ip.shape[2])))
有人可以帮我解决这个问题吗?
解决方案
这很奇怪!在我的笔记本中运行您的代码运行良好。我注意到'input_shape'不是官方keras上显示的LSTM层的参数
可能是版本问题!
我的版本:keras '2.2.4',tensorflow '1.11.0'
要绕过它,您可以尝试功能 api:
from keras.layers import Input
input1 = Input(shape =( final_ip.shape[1],final_ip.shape[2] ) )
x = LSTM(256)(input1)
model = Model(input1,x)
推荐阅读
- css - 我怎样才能用里面的文字创建一个圆圈?
- alsa - 使用多插件组合多个 dsnoop 设备
- npm - npm run build 在 bitbucket 管道中失败,因为它无法解析某些文件
- c++ - 如何在 c++ pytorch 前端 API 中将变量从 GPU 移动到 CPU?
- c# - 在 C# 中键入存储在同一数据库中的另一个值后,如何从数据库中读取值?
- fetch - Nutch Fetch 失败,协议状态为:TEMP_MOVED
- sql - vsql/Vertica:按组选择前 5 行
- scaling - 在 vsphere 上进行 OKD 缩放
- matlab - 将共线点添加到 polyshape (Matlab)
- asp.net-core - 如何在服务器 2016 上的 Asp.net core 2.2 kestrel(自托管)中启用 http/2