美文网首页
[tf]从checkpoint加载模型

[tf]从checkpoint加载模型

作者: VanJordan | 来源:发表于2018-12-26 16:08 被阅读22次
    
    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
    

    相关文章

      网友评论

          本文标题:[tf]从checkpoint加载模型

          本文链接:https://www.haomeiwen.com/subject/xcnhlqtx.html