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: Restores values of all variables of given variables collection from the checkpoint.
  
  Old values from the variables collection will be replaced with the new values read from checkpoint.
  If variable does not exist in the variables collection, it won't be restored from checkpoint.
  
  Args:
      vc: variables collection to restore.
      idx: if provided then checkpoint index to use, if None then latest checkpoint will be restored.
  
  Returns:
      idx: index of the restored checkpoint.
      ckpt: full path to the restored checkpoint.
docstr_tok: ["Restores","values","of","all","variables","of","given","variables","collection","from","the","checkpoint",".","Old","values","from","the","variables","collection","will","be","replaced","with","the","new","values","read","from","checkpoint",".","If","variable","does","not","exist","in","the","variables","collection",",","it","wo","n't","be","restored","from","checkpoint",".","Args",":","vc",":","variables","collection","to","restore",".","idx",":","if","provided","then","checkpoint","index","to","use",",","if","None","then","latest","checkpoint","will","be","restored",".","Returns",":","idx",":","index","of","the","restored","checkpoint",".","ckpt",":","full","path","to","the","restored","checkpoint","."]
code: def restore(self, vc: VarCollection, idx: Optional[int] = None):
      """Restores values of all variables of given variables collection from the checkpoint.
  
      Old values from the variables collection will be replaced with the new values read from checkpoint.
      If variable does not exist in the variables collection, it won't be restored from checkpoint.
  
      Args:
          vc: variables collection to restore.
          idx: if provided then checkpoint index to use, if None then latest checkpoint will be restored.
  
      Returns:
          idx: index of the restored checkpoint.
          ckpt: full path to the restored checkpoint.
      """
      assert isinstance(
          vc, VarCollection
      ), f"Must pass a VarCollection to restore; received type {type(vc)}."
      if idx is None:
          all_ckpts = glob.glob(
              os.path.join(self.logdir, self.DIR_NAME, self.FILE_MATCH)
          )
          if not all_ckpts:
              if self.verbose:
                  print(
                      "No checkpoints found. Skipping restoring variables."
                  )
              return 0, ""
          idx = self.checkpoint_idx(max(all_ckpts))
      ckpt = os.path.join(
          self.logdir, self.DIR_NAME, self.FILE_FORMAT % idx
      )
      if self.verbose:
          print("Resuming from", ckpt)
      self.LOAD_FN(ckpt, vc)
      return idx, ckpt
  
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 3 for calling the Checkpoint obj's underlying member method code with example usage: obj.restore(vc, idx) and returns: idx,  ckpt, int,  str