小编Naz*_*rin的帖子

Keras 中 LSTM 层的 4D 输入

我有形状为(10000, 20, 15, 4)where num samples = 10000, num series in time = 20, height = 15, 的数据weight = 4。所以我有15x4随时间分布的表。这是我想在这些数据上训练它的模型:

...
model.add((LSTM(nums-1,return_sequences=True,input_shape=(20,15,4), activation='relu')))
model.add((LSTM(nums-1,return_sequences=False,input_shape=(20,15,4), activation='tanh')))
model.add(Dense(15,activation='relu'))
...
Run Code Online (Sandbox Code Playgroud)

但是,我收到以下错误:

ValueError: Input 0 is incompatible with layer lstm_1: expected ndim=3, 
found ndim=4
Run Code Online (Sandbox Code Playgroud)

如何定义具有 4D 输入形状的 LSTM 层?

python machine-learning lstm keras tensorflow

6
推荐指数
1
解决办法
3670
查看次数

标签 统计

keras ×1

lstm ×1

machine-learning ×1

python ×1

tensorflow ×1