在我的 Keras 模型中,我使用的是 TimeDistributed 包装器,但我不断收到形状不匹配错误。以下是图层:
r_input = Input(shape=(100,), dtype='int32')
embedded_sequences = embedding_layer(r_input)
r_lstm = Bidirectional(GRU(100, return_sequences=True))(embedded_sequences)
r_dense = TimeDistributed(Dense(200))(r_lstm)
r_att = AttLayer()(r_dense)
sentEncoder = Model(r_input, r_att)
input = Input(shape=(100,15), dtype='int32')
encoder = TimeDistributed(sentEncoder)(input)
l_lstm = Bidirectional(GRU(100, return_sequences=True))(encoder) #-->>ERROR MESSAGE
我收到错误消息
ValueError:输入 0 与层 time_distributed_4 不兼容:预期 ndim=3,发现 ndim=4
如何调整编码器的形状以匹配双向层的输入?