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
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:
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]))
I was able to work around the problem by using model.save(export_path)
and tf.keras.load_model(export_path)
respectively. The relevant documentation can be found here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.