1
我试图复制example on Keras's website:不兼容的输入
# as the first layer in a Sequential model
model = Sequential()
model.add(LSTM(32, input_shape=(10, 64)))
# now model.output_shape == (None, 32)
# note: `None` is the batch dimension.
# for subsequent layers, no need to specify the input size:
model.add(LSTM(16))
但是当我运行以下命令:
# only lines I've added:
from keras.models import Sequential
from keras.layers import Dense, LSTM
# all else is the same:
model = Sequential()
model.add(LSTM(32, input_shape=(10, 64)))
model.add(LSTM(16))
不过,我得到以下几点:
ValueError: Input 0 is incompatible with layer lstm_4: expected ndim=3, found ndim=2
版本:
Keras: '2.0.5'
Python: '3.4.3'
Tensorflow: '1.2.1'
我的回答对你有帮助吗? –