class_docstr: Base class for a trainer.
      
docstr: Create the session and set `self.sess`.
  Call `self.initiailize_hooks()`
  Finalize the graph.
  
  It must be called after callbacks are setup.
  
  Args:
      session_creator (tf.train.SessionCreator):
      session_init (sessinit.SessionInit):
docstr_tok: ["Create","the","session","and","set","`","self.sess","`",".","Call","`","self.initiailize_hooks","(",")","`","Finalize","the","graph",".","It","must","be","called","after","callbacks","are","setup",".","Args",":","session_creator","(","tf.train.SessionCreator",")",":","session_init","(","sessinit.SessionInit",")",":"]
code: def initialize(self, session_creator, session_init):
      """
      Create the session and set `self.sess`.
      Call `self.initiailize_hooks()`
      Finalize the graph.
  
      It must be called after callbacks are setup.
  
      Args:
          session_creator (tf.train.SessionCreator):
          session_init (sessinit.SessionInit):
      """
      assert isinstance(
          session_creator, tfv1.train.SessionCreator
      ), session_creator
      assert isinstance(session_init, SessionInit), session_init
      session_init._setup_graph()
  
      logger.info("Creating the session ...")
  
      self.sess = session_creator.create_session()
      self.initialize_hooks()
  
      if self.is_chief:
          logger.info("Initializing the session ...")
          session_init._run_init(self.sess)
      else:
          if not isinstance(session_init, JustCurrentSession):
              logger.warn(
                  "This is not a chief worker, 'session_init' was ignored!"
              )
  
      self.sess.graph.finalize()
      logger.info("Graph Finalized.")
  
imports: import copy
  import time
  import weakref
  import tensorflow
  from ..compat import tfv1
  from ..callbacks import Callback, Callbacks, Monitors, MonitorBase
  from ..callbacks.steps import MaintainStepCounter
  from ..tfutils import get_global_step_value
  from ..tfutils.model_utils import describe_trainable_vars
  from ..tfutils.sesscreate import NewSessionCreator, ReuseSessionCreator
  from ..tfutils.sessinit import JustCurrentSession, SessionInit
  from ..utils import logger
  from ..utils.argtools import call_only_once
  from ..utils.utils import humanize_time_delta
  from .config import DEFAULT_CALLBACKS, DEFAULT_MONITORS, TrainConfig
label_desc: Use image node_id 5 for calling the Trainer obj's underlying member method code with example usage: obj.initialize(session_creator, session_init) without return types