import tensorflow as tf


        if monitorSession:
            # MonitoredSession
            # this will restore all the variables from the latest checkpoint if it exists
            self._fix_checkpoint_abs_to_rel(self._checkpoint_dir) # need to ensure checkpoint has relative path saved

            chiefsess_creator = tf.train.ChiefSessionCreator(config=sess_config, checkpoint_dir=self._checkpoint_dir)

            if self._restore_chkptfile is not None:
                self._network.init_saver()
            # this is restoring variables 
            self.sess = tf.train.MonitoredSession(session_creator=chiefsess_creator, hooks=self.hooks)

            # Restore from some checkpoint
            if self._restore_chkptfile is not None:
                raw_sess = self.get_raw_session()
                if raw_sess.run(self.global_step) == 0:
                    self._network.restore(raw_sess, self._restore_chkptfile)
        else:
            self.sess = tf.Session(config=sess_config)
            #all_variables = tf.get_collection_ref(tf.GraphKeys.GLOBAL_VARIABLES)
            #self.sess.run(tf.variables_initializer(all_variables))
