Saving the model to HDF5 format requires the model to be a Functional model or a Sequential model. It does not work for subclassed models, because such models are defined via the body of a Python method, which isn't safely serializable. Consider saving to the Tensorflow SavedModel format (by setting save_format="tf") or using `save_weights`.

 

利用tf.keras.model.save()保存的模型不能是子类,必须是一个函数模型或者是一个线性堆叠的模型

tf.save_model.save()保存的模型必须提供明确的输入