在网络(Keras 的模型,Sequential)中,输入层必须有 4 个神经元。输入必须是 1 个列表,长度为 4,每个元素是一个数字。
print("SHAPE:", np.array([1, 1, 1, 1]).shape)
self.model.fit(np.array([1, 1, 1, 1]),
self.rightAnswer,
epochs = 1,
batch_size = 1)
这是结论:
SHAPE: (4,)
ValueError: Error when checking input: expected dense_1_input to have shape (4,) but got array with shape (1,)
为什么会发生这种情况,我该如何解决?