笔者此处是一个回归任务, 最后一层是: ... pred = Dense(1)(x) 在最后一个Dense层前加上x = Flatten()(x)即可. 转载于:https://www.cnblogs.com/ZhengPeng7/p/9234902.html