class_docstr: A PPO Agent.
class_docstr_tok: ["A","PPO","Agent","."]
docstr: Create regularization loss tensor based on agent parameters.
docstr_tok: ["Create","regularization","loss","tensor","based","on","agent","parameters","."]
code: def entropy_regularization_loss(
      self,
      time_steps: ts.TimeStep,
      entropy: types.Tensor,
      weights: types.Tensor,
      debug_summaries: bool = False,
  ) -> types.Tensor:
      """Create regularization loss tensor based on agent parameters."""
      if self._entropy_regularization > 0:
          nest_utils.assert_same_structure(
              time_steps, self.time_step_spec
          )
          with tf.name_scope("entropy_regularization"):
              if self._aggregate_losses_across_replicas:
                  entropy_reg_loss = (
                      common.aggregate_losses(
                          per_example_loss=-entropy,
                          sample_weight=weights,
                      ).total_loss
                      * self._entropy_regularization
                  )
              else:
                  entropy_reg_loss = (
                      tf.math.reduce_mean(-entropy * weights)
                      * self._entropy_regularization
                  )
  
              if self._check_numerics:
                  entropy_reg_loss = tf.debugging.check_numerics(
                      entropy_reg_loss, "entropy_reg_loss"
                  )
  
              # TODO(b/171573175): remove the condition once histograms are supported
              # on TPUs.
              if (
                  debug_summaries
                  and not tf.config.list_logical_devices("TPU")
              ):
                  tf.compat.v2.summary.histogram(
                      name="entropy_reg_loss",
                      data=entropy_reg_loss,
                      step=self.train_step_counter,
                  )
      else:
          entropy_reg_loss = tf.constant(
              0.0, dtype=tf.float32, name="zero_entropy_reg_loss"
          )
  
      return entropy_reg_loss
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from typing import Optional, Text, Tuple
  from absl import logging
  import gin
  from six.moves import range
  from six.moves import zip
  import tensorflow
  from tf_agents.agents import data_converter
  from tf_agents.agents import tf_agent
  from tf_agents.agents.ppo import ppo_policy
  from tf_agents.agents.ppo import ppo_utils
  from tf_agents.networks import network
  from tf_agents.policies import greedy_policy
  from tf_agents.specs import tensor_spec
  from tf_agents.trajectories import time_step
  from tf_agents.trajectories import trajectory
  from tf_agents.typing import types
  from tf_agents.utils import common
  from tf_agents.utils import eager_utils
  from tf_agents.utils import nest_utils
  from tf_agents.utils import object_identity
  from tf_agents.utils import tensor_normalizer
  from tf_agents.utils import value_ops
label_desc: Use image node_id 13 for calling the PPOAgent obj's underlying member method code with example usage: obj.entropy_regularization_loss(time_steps, entropy, weights, debug_summaries) and returns: entropy_reg_loss