parameters: (self, checkpoint_index=None)
docstring: Saves all registered python objects in the given checkpoint directory
          using cPickle.
docstring_summary: Saves all registered python objects in the given checkpoint directory
          using cPickle.
docstring_tokens: Saves all registered python objects in the given checkpoint directory using cPickle .
function: def save(self, checkpoint_index=None):
          """
          Saves all registered python objects in the given checkpoint directory
          using cPickle.
  
          """
          # get attributes of registered objects
          checkpoint_data = OrderedDict()
          for obj_name in self.checkpoint_objects:
              checkpoint_data[obj_name] = self.__getattr_submodule(
                  self.calling_module, obj_name, None)
  
          if checkpoint_index is None:
              checkpoint_index = self.counter
          filename = os.path.join(
              self.checkpoint_dir, f"{checkpoint_index}.checkpoint")
  
          tmpname = filename + ".__tmp__"
          with open(tmpname, "wb") as checkpoint_file:
              pickle.dump(checkpoint_data, checkpoint_file, -1)
          os.rename(tmpname, filename)
function_tokens: def save ( self , checkpoint_index = None ) : # get attributes of registered objects checkpoint_data = OrderedDict ( ) for obj_name in self . checkpoint_objects : checkpoint_data [ obj_name ] = self . __getattr_submodule ( self . calling_module , obj_name , None ) if checkpoint_index is None : checkpoint_index = self . counter filename = os . path . join ( self . checkpoint_dir , f"{checkpoint_index}.checkpoint" ) tmpname = filename + ".__tmp__" with open ( tmpname , "wb" ) as checkpoint_file : pickle . dump ( checkpoint_data , checkpoint_file , - 1 ) os . rename ( tmpname , filename )