Saving model parameters and model selection

Saving model parameters is important since it's the only way to continue to train a model after an interruption, and the only way to checkpoint a model status for any reason—training finished, the model reached the best validation performance.

tf.Saver is the object the TensorFlow Python API provides to save the current model variables. Please note that the tf.Saver object saves the variables only and not the graph structure!

To save both the graph structure and variables, a SavedModel object is required; however, since the SavedModel object is more connected with putting a trained model into production, its definition and usage are demanded to the paragraph dedicated to the production.

The tf.Saver ...

Get Hands-On Neural Networks with TensorFlow 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.