class_docstr: Helper class for async checkpoint.
docstr: Initialize AsyncCheckpoint.
  
  Args:
    checkpointer_impl: The Checkpoint class to power the AsyncCheckpoint.
    root: The root object to checkpoint. `root` may be a trackable object or
      `WeakRef` of a trackable object.
    **kwargs: The keyword arguments representing the checkpointed variables.
  
  Raises:
    AttributeError: when checkpointer_impl is None.
docstr_tok: ["Initialize","AsyncCheckpoint",".","Args",":","checkpointer_impl",":","The","Checkpoint","class","to","power","the","AsyncCheckpoint",".","root",":","The","root","object","to","checkpoint",".","`","root","`","may","be","a","trackable","object","or","`","WeakRef","`","of","a","trackable","object",".","*","*","kwargs",":","The","keyword","arguments","representing","the","checkpointed","variables",".","Raises",":","AttributeError",":","when","checkpointer_impl","is","None","."]
code: def __init__(self, checkpointer_impl, root=None, **kwargs):
      """Initialize AsyncCheckpoint.
  
      Args:
        checkpointer_impl: The Checkpoint class to power the AsyncCheckpoint.
        root: The root object to checkpoint. `root` may be a trackable object or
          `WeakRef` of a trackable object.
        **kwargs: The keyword arguments representing the checkpointed variables.
  
      Raises:
        AttributeError: when checkpointer_impl is None.
      """
      # TODO(chienchunh): Make sure the processing for the root object is
      #   consistent when integrating with the public API, e.g., adding all kwarg
      #   items as the child of the root object.
      if root:
          trackable_root = (
              root() if isinstance(root, weakref.ref) else root
          )
          kwargs["root"] = trackable_root
          trackable_root._maybe_initialize_trackable()
  
      # The underlying Checkpoint instance and its items.
      if checkpointer_impl is None:
          raise AttributeError(
              "checkpointer_impl cannot be None for AsyncCheckpointHelper."
          )
      self._checkpointer_impl = checkpointer_impl
      self._checkpoint_items = kwargs
      self._checkpoint = None
      self.checkpointer()
      self._checkpoint_options = None
  
      # Indicate whether async checkpoint has finished traversing the variable
      # list and created the object map between the original and copied variables.
      self._initialized = False
  
      # The list of all nodes from the original checkpoint items.
      # TODO(chienchunh): Consider changing this to local variable.
      self._original_nodes = None
      # The mapping between the original and the copied resource variables.
      # The copied variables are used for the underlying checkpointing.
      self._object_map = None
      # A list of TPUEmbedding objects included in the checkpoint items.
      self._tpu_embedding_objects = None
      # A list of highest level `Trackable`s we will copy; does not contain
      # TPUEmbedding objects
      self._saveable_trackables = None
  
      self._default_device = device_util.current() or "CPU:0"
      self._default_device = device_util.canonicalize(
          self._default_device
      )
  
      self._save_file_prefix = None
      self._use_checkpoint_save = False
      self._async_save_thread = None
      # Concurrent queue that coordinates the events for writing/reading the
      # cpu-copied variables. A 'True' in the queue triggers the async thread to
      # perform saving; a 'False' breaks the while loop so that the async thread
      # exits; no other values will be added to the queue.
      # Maxsize is set to 1 only to ensure the exit procedure. We could have used
      # queue.join() in _join_async_save_thread(), but queue.join() does not have
      # a timeout argument. Hence we use queue.put(timeout=300), in case the last
      # checkpoint takes forever. To achieve that, maxsize needs to be 1.
      self._queue = queue.Queue(maxsize=1)
  
      # Register to join the async save thread upon exit.
      atexit.register(self._join_async_save_thread)
  
      self._async_error = None
  
      global _END_TIME_OF_LAST_ASYNC_WRITE
      with _END_TIME_OF_LAST_ASYNC_WRITE_LOCK:
          if _END_TIME_OF_LAST_ASYNC_WRITE is None:
              _END_TIME_OF_LAST_ASYNC_WRITE = time.time()
  
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 1 to create a new AsyncCheckpointHelper object  with example: obj = AsyncCheckpointHelper(checkpointer_impl, root)