class_docstr: Hook to print out examples per second.
  
  Total time is tracked and then divided by the total number of steps
  to get the average step time and then batch_size is used to determine
  the running average of examples per second. The examples per second for the
  most recent interval is also logged.
docstr: Called after each call to run().
  
  Args:
    run_context: A SessionRunContext object.
    run_values: A SessionRunValues object.
docstr_tok: ["Called","after","each","call","to","run","(",")",".","Args",":","run_context",":","A","SessionRunContext","object",".","run_values",":","A","SessionRunValues","object","."]
code: def after_run(
      self, run_context, run_values
  ):  # pylint: disable=unused-argument
      """Called after each call to run().
  
      Args:
        run_context: A SessionRunContext object.
        run_values: A SessionRunValues object.
      """
      global_step = run_values.results
  
      if (
          self._timer.should_trigger_for_step(global_step)
          and global_step > self._warm_steps
      ):
          (
              elapsed_time,
              elapsed_steps,
          ) = self._timer.update_last_triggered_step(global_step)
          if elapsed_time is not None:
              self._step_train_time += elapsed_time
              self._total_steps += elapsed_steps
  
              # average examples per second is based on the total (accumulative)
              # training steps and training time so far
              average_examples_per_sec = self._batch_size * (
                  self._total_steps / self._step_train_time
              )
              # current examples per second is based on the elapsed training steps
              # and training time per batch
              current_examples_per_sec = self._batch_size * (
                  elapsed_steps / elapsed_time
              )
              # Logs entries to be read from hook during or after run.
              self.current_examples_per_sec_list.append(
                  current_examples_per_sec
              )
              self._logger.log_metric(
                  "average_examples_per_sec",
                  average_examples_per_sec,
                  global_step=global_step,
              )
  
              self._logger.log_metric(
                  "current_examples_per_sec",
                  current_examples_per_sec,
                  global_step=global_step,
              )
  
file_path: autodist/examples/benchmark/utils/logs/hooks.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
  from utils.logs import logger
label_desc: Use image node_id 4 for calling the ExamplesPerSecondHook obj's underlying member method code with example usage: obj.after_run(run_context, run_values) without return types