class_docstr: An implementation of the DQN agent.
class_docstr_tok: ["An","implementation","of","the","DQN","agent","."]
docstr: Builds a training op.
  
  Returns:
    train_op: An op performing one step of training from replay data.
docstr_tok: ["Builds","a","training","op",".","Returns",":","train_op",":","An","op","performing","one","step","of","training","from","replay","data","."]
code: def _build_train_op(self):
      """Builds a training op.
  
      Returns:
        train_op: An op performing one step of training from replay data.
      """
      replay_action_one_hot = tf.one_hot(
          self._replay.actions,
          self.num_actions,
          1.0,
          0.0,
          name="action_one_hot",
      )
      replay_chosen_q = tf.reduce_sum(
          self._replay_net_outputs.q_values * replay_action_one_hot,
          axis=1,
          name="replay_chosen_q",
      )
  
      target = tf.stop_gradient(self._build_target_q_op())
      loss = tf.compat.v1.losses.huber_loss(
          target, replay_chosen_q, reduction=tf.losses.Reduction.NONE
      )
      if self.summary_writer is not None:
          with tf.compat.v1.variable_scope("Losses"):
              tf.compat.v1.summary.scalar(
                  "HuberLoss", tf.reduce_mean(loss)
              )
      return self.optimizer.minimize(tf.reduce_mean(loss))
  
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 6 for calling the DQNAgent obj's underlying member method code with example usage: obj._build_train_op() and returns: self