serialize keras model

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

Here is what the above code is Doing:
1. Save the weights of the model using the save_weights method.
2. Save the model architecture to a JSON file using the save_model method.
3. Save the entire model to a HDF5 file using the save method.
4. Recreate the exact same model, including its weights and the optimizer, from the HDF5 file.

Note that this technique saves everything: the architecture, weights, and optimizer state.

If you want to save only the architecture of a model, and not its weights or its training configuration, you can do so by serializing the model to JSON: