aa3c6a5f79d82044306f3a11f1de6b7231163d90,tf_agents/agents/dqn/dqn_agent.py,DqnAgent,_loss,#DqnAgent#Any#Any#Any#Any#Any#Any#,369

Before Change


        td_loss = tf.reduce_sum(input_tensor=td_loss, axis=1)

      if weights is not None:
        td_loss *= weights

      // Average across the elements of the batch.
      // Note: We use an element wise loss above to ensure each element is always
      //   weighted by 1/N where N is the batch size, even when some of the
      //   weights are zero due to boundary transitions. Weighting by 1/K where K
      //   is the actual number of non-zero weight would artificially increase
      //   their contribution in the loss. Think about what would happen as
      //   the number of boundary samples increases.
      loss = tf.reduce_mean(input_tensor=td_loss)

      // Add network loss (such as regularization loss)
      if self._q_network.losses:
        loss = loss + tf.reduce_mean(self._q_network.losses)

      with tf.name_scope("Losses/"):
        tf.compat.v2.summary.scalar(
            name="loss", data=loss, step=self.train_step_counter)

      if self._summarize_grads_and_vars:
        with tf.name_scope("Variables/"):
          for var in self._q_network.trainable_weights:
            tf.compat.v2.summary.histogram(

After Change


          per_example_loss=td_loss,
          sample_weight=weights,
          regularization_loss=self._q_network.losses)
      total_loss = agg_loss.total_loss

      losses_dict = {"td_loss": agg_loss.weighted,
                     "reg_loss": agg_loss.regularization,
                     "total_loss": total_loss}

      common.summarize_scalar_dict(losses_dict,
                                   step=self.train_step_counter,
                                   name_scope="Losses/")

      if self._summarize_grads_and_vars:
        with tf.name_scope("Variables/"):
          for var in self._q_network.trainable_weights:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 13

Instances


Project Name: tensorflow/agents
Commit Name: aa3c6a5f79d82044306f3a11f1de6b7231163d90
Time: 2020-02-24
Author: sguada@google.com
File Name: tf_agents/agents/dqn/dqn_agent.py
Class Name: DqnAgent
Method Name: _loss


Project Name: tensorflow/agents
Commit Name: 7ec9efd5cf6a479e8c5d85dcc950f464fd15b134
Time: 2020-02-28
Author: no-reply@google.com
File Name: tf_agents/agents/reinforce/reinforce_agent.py
Class Name: ReinforceAgent
Method Name: total_loss


Project Name: tensorflow/agents
Commit Name: aa3c6a5f79d82044306f3a11f1de6b7231163d90
Time: 2020-02-24
Author: sguada@google.com
File Name: tf_agents/agents/dqn/dqn_agent.py
Class Name: DqnAgent
Method Name: _loss


Project Name: tensorflow/agents
Commit Name: aa3c6a5f79d82044306f3a11f1de6b7231163d90
Time: 2020-02-24
Author: sguada@google.com
File Name: tf_agents/agents/behavioral_cloning/behavioral_cloning_agent.py
Class Name: BehavioralCloningAgent
Method Name: _loss