class_docstr: A TD3 Agent.
class_docstr_tok: ["A","TD3","Agent","."]
docstr: Computes the actor_loss for TD3 training.
  
  Args:
    time_steps: A batch of timesteps.
    weights: Optional scalar or element-wise (per-batch-entry) importance
      weights.
    training: Whether this loss is being used for training.
  
  Returns:
    actor_loss: A scalar actor loss.
docstr_tok: ["Computes","the","actor_loss","for","TD3","training",".","Args",":","time_steps",":","A","batch","of","timesteps",".","weights",":","Optional","scalar","or","element-wise","(","per-batch-entry",")","importance","weights",".","training",":","Whether","this","loss","is","being","used","for","training",".","Returns",":","actor_loss",":","A","scalar","actor","loss","."]
code: def actor_loss(
      self,
      time_steps: ts.TimeStep,
      weights: Optional[types.Tensor] = None,
      training: bool = False,
  ) -> types.Tensor:
      """Computes the actor_loss for TD3 training.
  
      Args:
        time_steps: A batch of timesteps.
        weights: Optional scalar or element-wise (per-batch-entry) importance
          weights.
        training: Whether this loss is being used for training.
  
      Returns:
        actor_loss: A scalar actor loss.
      """
      # TODO(b/124383618): Add an action norm regularizer.
      with tf.name_scope("actor_loss"):
          actions, _ = self._actor_network(
              time_steps.observation,
              time_steps.step_type,
              training=training,
          )
  
          q_values, _ = self._critic_network_1(
              (time_steps.observation, actions),
              time_steps.step_type,
              training=False,
          )
          actor_loss = -q_values
          # Sum over the time dimension.
          if actor_loss.shape.rank > 1:
              actor_loss = tf.reduce_sum(
                  actor_loss, axis=range(1, actor_loss.shape.rank)
              )
          actor_loss = common.aggregate_losses(
              per_example_loss=actor_loss, sample_weight=weights
          ).total_loss
  
          with tf.name_scope("Losses/"):
              tf.compat.v2.summary.scalar(
                  name="actor_loss",
                  data=actor_loss,
                  step=self.train_step_counter,
              )
  
      return actor_loss
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from typing import Optional, Text
  import gin
  import tensorflow
  import tensorflow_probability
  from tf_agents.agents import data_converter
  from tf_agents.agents import tf_agent
  from tf_agents.networks import network
  from tf_agents.policies import actor_policy
  from tf_agents.policies import gaussian_policy
  from tf_agents.trajectories import time_step
  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
label_desc: Use image node_id 7 for calling the Td3Agent obj's underlying member method code with example usage: obj.actor_loss(time_steps, weights, training) and returns: actor_loss