Keras 报错: Error when checking target: expected dense_4...

笔者此处是一个回归任务, 最后一层是:

...
pred = Dense(1)(x)

在最后一个Dense层前加上x = Flatten()(x)即可.

原文地址:https://www.cnblogs.com/ZhengPeng7/p/9234902.html