如何为Keras嵌入层提供适当形状的输入?

时间:2020-04-28 17:55:58

标签: keras nlp lstm recurrent-neural-network embedding

我正在为LLP问题开发LSTM程序。 我的数据和标签的形状为=(10,20,1)

我的模型代码如下:

model.add(Embedding(18,17,input_length=20,weights=[embedding_weights])) ( Shape of Embedding (18,17))
# encoder layer
model.add(LSTM(100, activation='relu', input_shape=(20, 1)))

# repeat vector
model.add(RepeatVector(20))

# decoder layer
model.add(LSTM(100, activation='relu', return_sequences=True))
model.add(TimeDistributed(Dense(1)))
model.compile(optimizer='adam', loss='mse')

我遇到以下错误

“ input_length”为20,但接收到的输入具有形状(无,20、1)

0 个答案:

没有答案