ValueError:输入0与图层OriginalEncoderLSTM_1不兼容:预期ndim = 3,找到的ndim = 4

时间:2019-01-10 07:16:37

标签: python-3.x

我试图将形状作为输入参数传递给函数Input()。我应该如何传递它以避免上述错误?

原始句子编码

original_sentence_input = Input(shape=(timesteps, input_dim), name="OriginalInput_1")
# original_sentence_input = Input(shape=(timesteps, input_dim,), name="OriginalInput_1")
embedding_layer = Embedding(30, input_dim + 1, mask_zero=True)
original_encoder_layer_1 = LSTM(intermediate_dim, return_sequences=True, name="OriginalEncoderLSTM_1")
original_encoder_layer_2 = LSTM(intermediate_dim, return_sequences=True, name="OriginalEncoderLSTM_2")
original_encoder_layer_3 = LSTM(intermediate_dim, return_sequences=True, name="OriginalEncoderLSTM_3")

encoded_original = embedding_layer(original_sentence_input)
encoded_original = original_encoder_layer_1(encoded_original)
# encoded_original = drop_out_layer(encoded_original)
encoded_original = original_encoder_layer_2(encoded_original)
# encoded_original = drop_out_layer(encoded_original)
encoded_original = original_encoder_layer_3(encoded_original)

0 个答案:

没有答案