我是lstm的新手,任何人都可以解释为什么我遇到此错误吗?
我的lstm模型-
def NNStructure():
input_text = tf.keras.Input((), dtype = tf.string, name = 'input_text')
initial_input= Embedding(vocab_size, 25, weights=
[embedding_matrix], input_length=50,trainable=False) (input_text)
lstm = LSTM(32, input_shape=(50,25))(initial_input)
secondary_input = Input(shape=(50,6))
merge = concatenate([lstm, secondary_input])(lstm)
first_dense = Dense(128, activation='relu')(merge)
second_dense=Dense(64, activation='relu')(first_dense)
output=Dense(1, activation='sigmoid')(second_dense)
model_glove1 = Model(inputs=[initial_input, secondary_input], outputs=output)
return model_glove1
model_glove1 = NNStructure() model_glove1.compile(loss ='binary_crossentropy',optimizer ='adam',metrics = ['accuracy']) model_glove1.fit(x = [pad_seq,X_meta_train],y = np.array(Y_train),batch_size = 32,epochs = 4,verbose = 1,validation_split = 0.2,shuffle = True)