class_docstr: Base class for a trainer.
      
docstr: Create SessionRunHooks for all callbacks, and hook it onto `self.sess` to create `self.hooked_sess`.
  
  A new trainer may override this method to create multiple groups of hooks,
  which can be useful when the training is not done by a single `train_op`.
docstr_tok: ["Create","SessionRunHooks","for","all","callbacks",",","and","hook","it","onto","`","self.sess","`","to","create","`","self.hooked_sess","`",".","A","new","trainer","may","override","this","method","to","create","multiple","groups","of","hooks",",","which","can","be","useful","when","the","training","is","not","done","by","a","single","`","train_op","`","."]
code: def initialize_hooks(self):
      """
      Create SessionRunHooks for all callbacks, and hook it onto `self.sess` to create `self.hooked_sess`.
  
      A new trainer may override this method to create multiple groups of hooks,
      which can be useful when the training is not done by a single `train_op`.
      """
      hooks = self._callbacks.get_hooks()
      self.hooked_sess = tfv1.train.MonitoredSession(
          session_creator=ReuseSessionCreator(self.sess), hooks=hooks
      )
  
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 6 for calling the Trainer obj's underlying member method code with example usage: obj.initialize_hooks() without return types