原因:要加载的模型没有设置compile,因为加载的模型默认的compile是true,也就是经过编译;如果需要加载的模型未加载过,则 设置如下即可: tf.keras.models.load_model(model_path,compile=False)