class_docstr: Same as :class:`TrainConfig`, but does the following to automatically
  resume from training:
  
  1. If a checkpoint was found in :meth:`logger.get_logger_dir()`, set
     `session_init` option to load it.
  2. If a JSON history was found in :meth:`logger.get_logger_dir()`, try to
     load the epoch number from it and set the `starting_epoch` option to
     continue training.
  
  You can choose to let the above two option to either overwrite or
  not overwrite user-provided arguments, as explained below.
  
  Note that the functionality requires the logging directory to obtain
  necessary information from a previous run.
  If you have unconventional setup of logging directory, this class will not
  work for you, for example:
  
      1. If you save the checkpoint to a different directory rather than the
         logging directory.
  
      2. If in distributed training the directory is not
         available to every worker, or the directories are different for different workers.
class_docstr_tok: ["Same","as",":","class",":","`","TrainConfig","`",",","but","does","the","following","to","automatically","resume","from","training",":","1",".","If","a","checkpoint","was","found","in",":","meth",":","`","logger.get_logger_dir","(",")","`",",","set","`","session_init","`","option","to","load","it",".","2",".","If","a","JSON","history","was","found","in",":","meth",":","`","logger.get_logger_dir","(",")","`",",","try","to","load","the","epoch","number","from","it","and","set","the","`","starting_epoch","`","option","to","continue","training",".","You","can","choose","to","let","the","above","two","option","to","either","overwrite","or","not","overwrite","user-provided","arguments",",","as","explained","below",".","Note","that","the","functionality","requires","the","logging","directory","to","obtain","necessary","information","from","a","previous","run",".","If","you","have","unconventional","setup","of","logging","directory",",","this","class","will","not","work","for","you",",","for","example",":","1",".","If","you","save","the","checkpoint","to","a","different","directory","rather","than","the","logging","directory",".","2",".","If","in","distributed","training","the","directory","is","not","available","to","every","worker",",","or","the","directories","are","different","for","different","workers","."]
code: def get_sessinit_resume(dir=None):
      if dir is None:
          dir = logger.get_logger_dir()
      if not dir:
          return None
      path = os.path.join(dir, "checkpoint")
      if not tfv1.gfile.Exists(path):
          return None
      return SaverRestore(path)
  
file_path: tensorpack/tensorpack/train/config.py
imports: import os
  from ..compat import tfv1
  from ..callbacks import JSONWriter, MergeAllSummaries, MovingAverageSummary, ProgressBar, RunUpdateOps, ScalarPrinter, TFEventWriter
  from ..dataflow.base import DataFlow
  from ..input_source import InputSource
  from ..tfutils.sesscreate import NewSessionCreator
  from ..tfutils.sessinit import SaverRestore, SessionInit
  from ..utils import logger
  from .model_desc import ModelDescBase
label_desc: Use image node_id 2 for calling the AutoResumeTrainConfig obj's underlying member method code with example usage: obj.get_sessinit_resume(dir) and returns: SaverRestore, None, None