[英]What changes when saving and loading a model using tf.saved_model
I was following the official TensorFlow quick start tutorial and I wanted to save and load the model, but the following code raises on the final line我正在关注官方 TensorFlow 快速入门教程,我想保存并加载 model,但最后一行出现以下代码
ValueError: Could not find matching function to call loaded from the SavedModel. Got:
Positional arguments (3 total):
* Tensor("inputs:0", shape=(1, 28, 28), dtype=float64)
* False
* None
Keyword arguments: {}
with declaring a keras sequential model and saving like so:声明一个 keras 顺序 model 并像这样保存:
print(model(x_train[:1]))
tf.saved_model.save(model, export_path)
loaded_model = tf.saved_model.load(export_path)
print(loaded_model(x_train[:1]))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.