class SimpleSession(object): def __init__(self, hooks=None): env = current_env() if env is None: self._is_chief = True else: self._is_chief = env.is_chief if hooks is None: hooks = [] self._hooks = hooks if self._is_chief: #self._hooks = self._hooks + [ChiefHook(), WorkerHook()] self._hooks = self._hooks + [ChiefHook()] else: self._hooks = self._hooks + [WorkerHook()] def take_priority(elem): return elem._priority self._hooks.sort(key=take_priority) self._session = Session(self._hooks) def run(self, v, run_option=None, run_statistic=None): return self._session.run(v, run_option, run_statistic) def end(self): return self._session.end()
def __init__(self, hooks=None): env = current_env() if env is None: self._is_chief = True else: self._is_chief = env.is_chief if hooks is None: hooks = [] self._hooks = hooks if self._is_chief: self._hooks = [ChiefHook(), WorkerHook()] + self._hooks else: self._hooks = [WorkerHook()] + self._hooks self._session = Session(self._hooks)
def __init__(self, hooks=None): env = current_env() if env is None: self._is_chief = True else: self._is_chief = env.is_chief if hooks is None: hooks = [] self._hooks = hooks if self._is_chief: #self._hooks = self._hooks + [ChiefHook(), WorkerHook()] self._hooks = self._hooks + [ChiefHook()] else: self._hooks = self._hooks + [WorkerHook()] def take_priority(elem): return elem._priority self._hooks.sort(key=take_priority) self._session = Session(self._hooks)
class SimpleSession(object): def __init__(self, hooks=None): env = current_env() if env is None: self._is_chief = True else: self._is_chief = env.is_chief if hooks is None: hooks = [] self._hooks = hooks if self._is_chief: self._hooks = [ChiefHook(), WorkerHook()] + self._hooks else: self._hooks = [WorkerHook()] + self._hooks self._session = Session(self._hooks) def run(self, v, run_option=None, run_statistic=None, feed_dict=None): return self._session.run(v, run_option, run_statistic, feed_dict=feed_dict) def end(self): return self._session.end()