我正在尝试在 TensorFlow 中实现ENet(具有瓶颈层)。瓶颈层具有层的自定义类定义。
现在,Model.predict() 有效,但是,我正在尝试将其转换为 protubuf 格式,并且当我执行 model.save() 时,会显示以下错误:
NotImplementedError: 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'.
我可以使用model.save_weights() 保存模型权重,但我想在 Tensorflow C++ 中加载这个模型。如何解决此问题并使用model.save()保存我的模型?