class_docstr: Helper class which performs saving and restoring of the variables.
  
  Variables are stored in the checkpoint files. One checkpoint file stores a single snapshot of the variables.
  Different checkpoint files store different snapshots of the variables (for example at different training step).
  Each checkpoint has associated index, which is used to identify time when snapshot of the variables was made.
  Typically training step or training epoch are used as an index.
class_docstr_tok: ["Helper","class","which","performs","saving","and","restoring","of","the","variables",".","Variables","are","stored","in","the","checkpoint","files",".","One","checkpoint","file","stores","a","single","snapshot","of","the","variables",".","Different","checkpoint","files","store","different","snapshots","of","the","variables","(","for","example","at","different","training","step",")",".","Each","checkpoint","has","associated","index",",","which","is","used","to","identify","time","when","snapshot","of","the","variables","was","made",".","Typically","training","step","or","training","epoch","are","used","as","an","index","."]
docstr: Creates instance of the Checkpoint class.
  
  Args:
      logdir: model directory. Checkpoints will be saved in the subdirectory of model directory.
      keep_ckpts: maximum number of checkpoints to keep.
      makedir: if True then directory for checkpoints will be created,
          otherwise it's expected that directory already exists.
      verbose: if True then print when data is restored from checkpoint.
docstr_tok: ["Creates","instance","of","the","Checkpoint","class",".","Args",":","logdir",":","model","directory",".","Checkpoints","will","be","saved","in","the","subdirectory","of","model","directory",".","keep_ckpts",":","maximum","number","of","checkpoints","to","keep",".","makedir",":","if","True","then","directory","for","checkpoints","will","be","created",",","otherwise","it","'s","expected","that","directory","already","exists",".","verbose",":","if","True","then","print","when","data","is","restored","from","checkpoint","."]
code: def __init__(
      self,
      logdir: str,
      keep_ckpts: int,
      makedir: bool = True,
      verbose: bool = True,
  ):
      """Creates instance of the Checkpoint class.
  
      Args:
          logdir: model directory. Checkpoints will be saved in the subdirectory of model directory.
          keep_ckpts: maximum number of checkpoints to keep.
          makedir: if True then directory for checkpoints will be created,
              otherwise it's expected that directory already exists.
          verbose: if True then print when data is restored from checkpoint.
      """
      self.logdir = logdir
      self.keep_ckpts = keep_ckpts
      self.verbose = verbose
      if makedir:
          os.makedirs(
              os.path.join(logdir, self.DIR_NAME), exist_ok=True
          )
  
file_path: objax/objax/io/checkpoint.py
imports: import glob
  import os
  from typing import Callable, Optional
  from objax.io.ops import load_var_collection, save_var_collection
  from objax.typing import FileOrStr
  from objax.variable import VarCollection
label_desc: Use image node_id 1 to create a new Checkpoint object  with example: obj = Checkpoint(logdir, keep_ckpts, makedir, verbose)