snowkylin / tensorflow-handbook

简单粗暴 TensorFlow 2 | A Concise Handbook of TensorFlow 2 | 一本简明的 TensorFlow 2 入门指导教程
https://tf.wiki
3.94k stars 841 forks source link

may could prefer model.save but not tf.saved_model.save #40

Open qhduan opened 4 years ago

qhduan commented 4 years ago

https://www.tensorflow.org/guide/keras/save_and_serialize

# Save the model
model.save('path_to_my_model.h5')

# Recreate the exact same model purely from the file
new_model = keras.models.load_model('path_to_my_model.h5')