def before_run(self, run_context):
    if (self._last_step is None):
        self._last_step = (run_context.session.run(self._global_step_tensor) + 1)
    request = {self._global_step_tensor: self._global_step_tensor}
    monitor_fetches = []
    for m in self._monitors:
        monitor_requests = m.step_begin(self._last_step)
        if monitor_requests:
            if (not isinstance(monitor_requests, list)):
                raise ValueError('Monitor.step_begin should return a list.')
            monitor_fetches.extend(monitor_requests)
    if monitor_fetches:
        request['monitors'] = dict(zip(monitor_fetches, [_as_graph_element(f) for f in monitor_fetches]))
    return session_run_hook.SessionRunArgs(request)
def before_run(self, run_context):
    if (self._last_step is None):
        self._last_step = (run_context.session.run(self._global_step_tensor) + 1)
    request = {self._global_step_tensor: self._global_step_tensor}
    monitor_fetches = []
    for m in self._monitors:
        monitor_requests = m.step_begin(self._last_step)
        if monitor_requests:
            if (not isinstance(monitor_requests, list)):
                raise ValueError('Monitor.step_begin should return a list.')
            monitor_fetches.extend(monitor_requests)
    if monitor_fetches:
        request['monitors'] = dict(zip(monitor_fetches, [_as_graph_element(f) for f in monitor_fetches]))
    return session_run_hook.SessionRunArgs(request)