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: Saves variables collection to checkpoint with given index.
  
  Args:
      vc: variables collection to save.
      idx: index of the new checkpoint where variables should be saved.
docstr_tok: ["Saves","variables","collection","to","checkpoint","with","given","index",".","Args",":","vc",":","variables","collection","to","save",".","idx",":","index","of","the","new","checkpoint","where","variables","should","be","saved","."]
code: def save(self, vc: VarCollection, idx: int):
      """Saves variables collection to checkpoint with given index.
  
      Args:
          vc: variables collection to save.
          idx: index of the new checkpoint where variables should be saved.
      """
      assert isinstance(
          vc, VarCollection
      ), f"Must pass a VarCollection to save; received type {type(vc)}."
      self.SAVE_FN(
          os.path.join(
              self.logdir, self.DIR_NAME, self.FILE_FORMAT % idx
          ),
          vc,
      )
      for ckpt in sorted(
          glob.glob(
              os.path.join(self.logdir, self.DIR_NAME, self.FILE_MATCH)
          )
      )[: -self.keep_ckpts]:
          os.remove(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 4 for calling the Checkpoint obj's underlying member method code with example usage: obj.save(vc, idx) without return types