class_docstr: Saves checkpoints every N steps or seconds.
class_docstr_tok: ["Saves","checkpoints","every","N","steps","or","seconds","."]
code: def after_create_session(
      self, session: session_lib.Session, coord: Any
  ):
      global_step = session.run(self._global_step_tensor)
  
      # We do write graph and saver_def at the first call of before_run.
      # We cannot do this in begin, since we let other hooks to change graph and
      # add variables in begin. Graph is finalized after all begin calls.
      def _write_graph_fn(self):
          training_util.write_graph(
              ops.get_default_graph().as_graph_def(add_shapes=True),
              self._checkpoint_dir,
              "graph.pbtxt",
          )
  
      self._write_graph_thread = threading.Thread(
          target=_write_graph_fn, args=[self]
      )
      self._write_graph_thread.start()
  
      saver_def = (
          self._get_saver().saver_def if self._get_saver() else None
      )
      graph = ops.get_default_graph()
      meta_graph_def = meta_graph.create_meta_graph_def(
          graph_def=graph.as_graph_def(add_shapes=True),
          saver_def=saver_def,
      )
      if self._summary_writer is None:
          raise ValueError("Summary writer is not initialised")
      self._summary_writer.add_graph(graph)
      self._summary_writer.add_meta_graph(meta_graph_def)
      # The checkpoint saved here is the state at step "global_step".
      self._save(session, global_step)
      self._timer.update_last_triggered_step(global_step)
  
imports: import os
  import threading
  import time
  from typing import Any, List, Optional, Text
  from tensorflow.core.util import event_pb2
  from tensorflow.python.client import session
  from tensorflow.python.framework import meta_graph
  from tensorflow.python.framework import ops
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.saved_model.pywrap_saved_model import metrics
  from tensorflow.python.training import basic_session_run_hooks
  from tensorflow.python.training import monitored_session
  from tensorflow.python.training import saver
  from tensorflow.python.training import session_run_hook
  from tensorflow.python.training import training_util
  from tensorflow.python.training.summary_io import SummaryWriterCache
label_desc: Use image node_id 4 for calling the AsyncCheckpointSaverHook obj's underlying member method code with example usage: obj.after_create_session(session, coord) without return types