class_docstr: A SAC Agent.
class_docstr_tok: ["A","SAC","Agent","."]
docstr: Returns the loss of the provided experience.
  
  This method is only used at test time!
  
  Args:
    experience: A time-stacked trajectory object.
    weights: Optional scalar or elementwise (per-batch-entry) importance
      weights.
    training: Whether this loss is being calculated as part of training.
  
  Returns:
    A `LossInfo` containing the loss for the experience.
docstr_tok: ["Returns","the","loss","of","the","provided","experience",".","This","method","is","only","used","at","test","time","!","Args",":","experience",":","A","time-stacked","trajectory","object",".","weights",":","Optional","scalar","or","elementwise","(","per-batch-entry",")","importance","weights",".","training",":","Whether","this","loss","is","being","calculated","as","part","of","training",".","Returns",":","A","`","LossInfo","`","containing","the","loss","for","the","experience","."]
code: def _loss(
      self,
      experience: types.NestedTensor,
      weights: Optional[types.Tensor] = None,
      training: bool = False,
  ):
      """Returns the loss of the provided experience.
  
      This method is only used at test time!
  
      Args:
        experience: A time-stacked trajectory object.
        weights: Optional scalar or elementwise (per-batch-entry) importance
          weights.
        training: Whether this loss is being calculated as part of training.
  
      Returns:
        A `LossInfo` containing the loss for the experience.
      """
      transition = self._as_transition(experience)
      time_steps, policy_steps, next_time_steps = transition
      actions = policy_steps.action
      critic_loss = self._critic_loss_weight * self.critic_loss(
          time_steps,
          actions,
          next_time_steps,
          td_errors_loss_fn=self._td_errors_loss_fn,
          gamma=self._gamma,
          reward_scale_factor=self._reward_scale_factor,
          weights=weights,
          training=training,
      )
      tf.debugging.check_numerics(
          critic_loss, "Critic loss is inf or nan."
      )
  
      actor_loss = self._actor_loss_weight * self.actor_loss(
          time_steps, weights=weights, training=training
      )
      tf.debugging.check_numerics(
          actor_loss, "Actor loss is inf or nan."
      )
  
      alpha_loss = self._alpha_loss_weight * self.alpha_loss(
          time_steps, weights=weights, training=training
      )
      tf.debugging.check_numerics(
          alpha_loss, "Alpha loss is inf or nan."
      )
  
      with tf.name_scope("Losses"):
          tf.compat.v2.summary.scalar(
              name="critic_loss",
              data=critic_loss,
              step=self.train_step_counter,
          )
          tf.compat.v2.summary.scalar(
              name="actor_loss",
              data=actor_loss,
              step=self.train_step_counter,
          )
          tf.compat.v2.summary.scalar(
              name="alpha_loss",
              data=alpha_loss,
              step=self.train_step_counter,
          )
  
      total_loss = critic_loss + actor_loss + alpha_loss
  
      extra = SacLossInfo(
          critic_loss=critic_loss,
          actor_loss=actor_loss,
          alpha_loss=alpha_loss,
      )
  
      return tf_agent.LossInfo(loss=total_loss, extra=extra)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from typing import Callable, Optional, Text
  import gin
  import numpy
  from six.moves import zip
  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 tf_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 SacAgent obj's underlying member method code with example usage: obj._loss(experience, weights, training) and returns: tf_agent