class_docstr: Helper class for async checkpoint.
class_docstr_tok: ["Helper","class","for","async","checkpoint","."]
docstr: Save the checkpointed variables.
  
  Args:
    save_path: The file prefix of the checkpoint file.
    options: Optional CheckpointOption instance.
  
  Returns:
    The full path of the checkpoint file.
docstr_tok: ["Save","the","checkpointed","variables",".","Args",":","save_path",":","The","file","prefix","of","the","checkpoint","file",".","options",":","Optional","CheckpointOption","instance",".","Returns",":","The","full","path","of","the","checkpoint","file","."]
code: def save(self, save_path, options=None):
      """Save the checkpointed variables.
  
      Args:
        save_path: The file prefix of the checkpoint file.
        options: Optional CheckpointOption instance.
  
      Returns:
        The full path of the checkpoint file.
      """
      save_start_time = time.time()
  
      # If this is the first time that AsyncCheckpoint.save() is called,
      # initialize the internal states like `self._saveable_trackables`. We also
      # populate `self._object_map` (i.e. initializing the cpu-copied variables
      # and copy over the value for the first time) by essentially performing a
      # `self._copy_to_cpu()`, hence the if-else logic here.
      #
      # This is not performed in the initializer because some variables, e.g.,
      # slot variables of the optimizer, were not created until actually running
      # the train function, so we could only get the complete list of the
      # variables after some train steps were run.
      if not self._initialized:
          self._ensure_initialized()
      else:
          # First wait for async thread to finish the previous save, then copy the
          # variable values to the host CPU.
          self._queue.join()
          self._copy_to_cpu()
  
      # Surface the error from the async thread, if any.
      # This step should come after the sem acquision step in the above, so that
      # it makes sure it waits until the previous async save finishes storing the
      # error.
      self._check_async_thread_error()
  
      # Retrieve the save counter from the underlying checkpoint object to
      # re-construct the full path of the checkpoint file.
      # This step has to happen before triggering the underlying checkpoint;
      # otherwise, the save_counter value may or may not have been updated.
      save_counter = self.checkpointer().save_counter.numpy() + 1
      full_path = "{}-{}".format(save_path, save_counter)
  
      # Trigger the async thread to checkpoint the cpu-copied variables.
      # Need to wait until the weight copying finishes before checkpoint save.
      context.async_wait()
      self._save_file_prefix = save_path
      self._use_checkpoint_save = True
  
      # Ensure that we do not request async checkpointing to the underlying
      # checkpointer as this could lead to an infinite loop.
      self._checkpoint_options = copy.copy(options) if options else None
      if self._checkpoint_options:
          self._checkpoint_options.experimental_enable_async_checkpoint = (
              False
          )
  
      self._queue.put(True)  # Trigger save in async thread
  
      save_end_time = time.time()
      metrics.AddCheckpointWriteDuration(
          api_label=_ASYNC_CHECKPOINT,
          microseconds=_get_duration_microseconds(
              save_start_time, save_end_time
          ),
      )
  
      return full_path
  
imports: import atexit
  import copy
  import queue
  import threading
  import time
  import weakref
  from absl import logging
  from tensorflow.python.checkpoint import checkpoint_context
  from tensorflow.python.checkpoint import trackable_view
  from tensorflow.python.distribute import device_util
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.eager import executor
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import variables
  from tensorflow.python.saved_model.pywrap_saved_model import metrics
  from tensorflow.python.trackable import base
  from tensorflow.python.util import object_identity
label_desc: Use image node_id 12 for calling the AsyncCheckpointHelper obj's underlying member method code with example usage: obj.save(save_path, options) and returns: full_path