class_docstr: An implementation of the DQN agent.
class_docstr_tok: ["An","implementation","of","the","DQN","agent","."]
docstr: Runs a single training step.
  
  Runs a training op if both:
    (1) A minimum number of frames have been added to the replay buffer.
    (2) `training_steps` is a multiple of `update_period`.
  
  Also, syncs weights from online to target network if training steps is a
  multiple of target update period.
docstr_tok: ["Runs","a","single","training","step",".","Runs","a","training","op","if","both",":","(","1",")","A","minimum","number","of","frames","have","been","added","to","the","replay","buffer",".","(","2",")","`","training_steps","`","is","a","multiple","of","`","update_period","`",".","Also",",","syncs","weights","from","online","to","target","network","if","training","steps","is","a","multiple","of","target","update","period","."]
code: def _train_step(self):
      """Runs a single training step.
  
      Runs a training op if both:
        (1) A minimum number of frames have been added to the replay buffer.
        (2) `training_steps` is a multiple of `update_period`.
  
      Also, syncs weights from online to target network if training steps is a
      multiple of target update period.
      """
      # Run a train op at the rate of self.update_period if enough training steps
      # have been run. This matches the Nature DQN behaviour.
      if self._replay.memory.add_count > self.min_replay_history:
          if self.training_steps % self.update_period == 0:
              self._sess.run(self._train_op)
              if (
                  self.summary_writer is not None
                  and self.training_steps > 0
                  and self.training_steps
                  % self.summary_writing_frequency
                  == 0
              ):
                  summary = self._sess.run(self._merged_summaries)
                  self.summary_writer.add_summary(
                      summary, self.training_steps
                  )
  
          if self.training_steps % self.target_update_period == 0:
              self._sess.run(self._sync_qt_ops)
  
      self.training_steps += 1
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import os
  import random
  from absl import logging
  from dopamine.discrete_domains import atari_lib
  from dopamine.replay_memory import circular_replay_buffer
  import gin.tf
  import numpy
  import tensorflow
label_desc: Use image node_id 12 for calling the DQNAgent obj's underlying member method code with example usage: obj._train_step() without return types