'Setup the trainer and be ready for the main loop.'

def setup(self):

    self.register_callback(MaintainStepCounter())
    for cb in self.config.callbacks:
        self.register_callback(cb)
    for m in self.config.monitors:
        self.register_monitor(m)
    self.monitors = Monitors(self.monitors)
    self.register_callback(self.monitors)
    describe_trainable_vars()
    logger.info('Setup    callbacks    graph    ...')
    self._callbacks = Callbacks(self._callbacks)
    self._callbacks.setup_graph(weakref.proxy(self))
    logger.info('Creating    the    session    ...')
    self._create_session()
    if self.is_chief:
        logger.info('Initializing    the    session    ...')
        self.config.session_init.init(self.sess)
    else:
        assert isinstance(self.config.session_init, JustCurrentSession), 'session_init    is    only    valid    for    chief    worker    session!'
    self.sess.graph.finalize()
    logger.info('Graph    Finalized.')
