class_docstr: Train and evaluate DQN on Atari.
class_docstr_tok: ["Train","and","evaluate","DQN","on","Atari","."]
docstr: Log some stats if global_step_val is a multiple of log_interval.
docstr_tok: ["Log","some","stats","if","global_step_val","is","a","multiple","of","log_interval","."]
code: def _maybe_log(self, sess, global_step_val, total_loss):
      """Log some stats if global_step_val is a multiple of log_interval."""
      if global_step_val % self._log_interval == 0:
          logging.info(
              "step = %d, loss = %f", global_step_val, total_loss.loss
          )
          logging.info(
              "%s",
              "action_time = {}".format(self._action_timer.value()),
          )
          logging.info(
              "%s", "step_time = {}".format(self._step_timer.value())
          )
          logging.info(
              "%s",
              "observer_time = {}".format(self._observer_timer.value()),
          )
          steps_per_sec = (global_step_val - self._timed_at_step) / (
              self._collect_timer.value() + self._train_timer.value()
          )
          sess.run(
              self._steps_per_second_summary,
              feed_dict={self._steps_per_second_ph: steps_per_sec},
          )
          logging.info("%.3f steps/sec", steps_per_sec)
          logging.info(
              "%s",
              "collect_time = {}, train_time = {}".format(
                  self._collect_timer.value(), self._train_timer.value()
              ),
          )
          for metric in self._train_metrics:
              log_metric(metric, prefix="Train/Metrics")
          self._timed_at_step = global_step_val
          self._collect_timer.reset()
          self._train_timer.reset()
          self._action_timer.reset()
          self._step_timer.reset()
          self._observer_timer.reset()
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from absl import app
  from absl import flags
  from absl import logging
  import gin
  import numpy
  import tensorflow
  from tf_agents.agents.categorical_dqn import categorical_dqn_agent
  from tf_agents.environments import batched_py_environment
  from tf_agents.environments import suite_atari
  from tf_agents.eval import metric_utils
  from tf_agents.metrics import py_metric
  from tf_agents.metrics import py_metrics
  from tf_agents.networks import categorical_q_network
  from tf_agents.networks import network
  from tf_agents.policies import epsilon_greedy_policy
  from tf_agents.policies import py_tf_policy
  from tf_agents.policies import random_py_policy
  from tf_agents.replay_buffers import py_hashed_replay_buffer
  from tf_agents.specs import tensor_spec
  from tf_agents.trajectories import policy_step
  from tf_agents.trajectories import time_step
  from tf_agents.trajectories import trajectory
  from tf_agents.utils import common
  from tf_agents.utils import timer
label_desc: Use image node_id 11 for calling the TrainEval obj's underlying member method code with example usage: obj._maybe_log(sess, global_step_val, total_loss) without return types