def restore_from_checkpoint(sess, saver):
"""Restore model from checkpoint.
Args:
sess: Session.
saver: Saver for restoring the checkpoint.
Returns:
bool: Whether the checkpoint was found and restored
"""
ckpt = tf.train.get_checkpoint_state(FLAGS.checkpoint_dir)
if not ckpt or not ckpt.model_checkpoint_path:
tf.logging.info('No checkpoint found at %s', FLAGS.checkpoint_dir)
return False
saver.restore(sess, ckpt.model_checkpoint_path)
return True
网友评论