有人可以帮我理解这个错误是怎么回事吗?
model = Sequential()
model.add(Embedding(82, 100, weights=[embedding_matrix], input_length=1000))
model.add(LSTM(100))
model.add(Dense(100, activation = 'sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
print(model.summary())
model.fit(x_train, y_train, epochs = 5, batch_size=64)
当我运行这个 LSTM 模型时,我收到一个错误
ValueError: Error when checking model target: expected dense_16 to have shape (None, 100) but got array with shape (16, 2)
我不确定以下信息有多大用处:
x_train.shape
Out[959]: (16, 1000)
y_train.shape
Out[962]: (16, 2)
如果您需要任何其他信息,我随时准备提供