class_docstr: A DDPG Agent.
code: def _loss(self, experience, weights=None, training=False):
      transition = self._as_transition(experience)
      time_steps, policy_steps, next_time_steps = transition
      actions = policy_steps.action
  
      critic_loss = self.critic_loss(
          time_steps,
          actions,
          next_time_steps,
          weights=weights,
          training=training,
      )
      tf.debugging.check_numerics(
          critic_loss, "Critic loss is inf or nan."
      )
  
      actor_loss = self.actor_loss(
          time_steps, weights=weights, training=training
      )
      tf.debugging.check_numerics(
          actor_loss, "Actor loss is inf or nan."
      )
  
      total_loss = actor_loss + critic_loss
      return tf_agent.LossInfo(
          total_loss, DdpgInfo(actor_loss, critic_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
  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 ou_noise_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
label_desc: Use image node_id 5 for calling the DdpgAgent obj's underlying member method code with example usage: obj._loss(experience, weights, training) and returns: tf_agent