tf.keras.models.save_model

View source on GitHub

Saves a model as a TensorFlow SavedModel or HDF5 file.

tf.keras.models.save_model(
    model, filepath, overwrite=True, include_optimizer=True, save_format=None,
    signatures=None, options=None
)

The saved model contains: - the model's configuration (topology) - the model's weights - the model's optimizer's state (if any)

Thus the saved model can be reinstantiated in the exact same state, without any of the code used for model definition or training.

SavedModel serialization (not yet added)

The SavedModel serialization path uses tf.saved_model.save to save the model and all trackable objects attached to the model (e.g. layers and variables). @tf.function-decorated methods are also saved. Additional trackable objects and functions are added to the SavedModel to allow the model to be loaded back as a Keras Model object.

Arguments:

Raises: