To save variables from the TensorFlow session for future use, you can use the Saver() function, which is as follows:
saver = tf.train.Saver()
Later, you can retrieve the state of the model and avoid tedious retraining by restoring the following checkpoint:
ckpt = tf.train.get_checkpoint_state(FLAGS.checkpoint_dir) if ckpt and ckpt.model_checkpoint_path: saver.restore(sess, ckpt.model_checkpoint_path)