输入0与lstm_34层不兼容:预期ndim = 3,找到的ndim = 2

时间:2020-03-24 19:35:47

标签: python keras deep-learning

我正在将(822222,2)的2D数组输入此模型:

regressor = Sequential()                                                      

regressor.add (LSTM  (2, activation = 'sigmoid', dropout = .1))
regressor.add (Dense (2, activation = 'tanh'))                  
regressor.compile (optimizer = 'rmsprop', loss = 'mean_squared_error')

regressor.fit (x = document, y = document, batch_size = 32, epochs = 1000)

但是这会在最后一行返回错误,仅接受带有ndim = 3的数组:

Input 0 is incompatible with layer lstm_34: expected ndim=3, found ndim=2

我尝试重塑,但是我提供的大多数配置都使数据无法使用。是什么让模型接受我的输入?

0 个答案:

没有答案