我有以下代码:
max_features = 5000
maxlen = 140
model = Sequential()
model.add(Embedding(max_features, 128))
model.add(LSTM(128, activation = 'sigmoid', inner_activation = 'hard_sigmoid', return_sequences = False))
model.add(Dense(input_dim = 128, output_dim = 2, activation = 'softmax'))
optimizer = Adam(lr = 0.001, beta_1 = 0.9, beta_2 = 0.999, epsilon = 1e-8)
model.compile(loss = 'categorical_crossentropy', optimizer = optimizer)
model.fit(x_train, y_train, batch_size = 64, nb_epoch = 10, verbose = 2)
y_test_pred = model.predict_classes(x_test)
但是每次我运行它时,我都会在该行出现错误
model.compile(loss = 'categorical_crossentropy', optimizer = optimizer)
其中指出:
AssertionError: The number of inputs given to the inner function of scan does not match the number of inputs given to scan.
有谁知道那是什么意思?