docstr: Specifies loss block to be used for this policy head.
  
  :return: loss block (can be called as function) for action probabilities returned by this policy network.
docstr_tok: ["Specifies","loss","block","to","be","used","for","this","policy","head",".",":","return",":","loss","block","(","can","be","called","as","function",")","for","action","probabilities","returned","by","this","policy","network","."]
code: def loss(self) -> mx.gluon.loss.Loss:
      """
      Specifies loss block to be used for this policy head.
  
      :return: loss block (can be called as function) for action probabilities returned by this policy network.
      """
      if isinstance(self.spaces.action, DiscreteActionSpace):
          loss = ClippedPPOLossDiscrete(
              len(self.spaces.action.actions),
              self.clip_likelihood_ratio_using_epsilon,
              self.beta,
              self.use_kl_regularization,
              self.initial_kl_coefficient,
              self.kl_cutoff,
              self.high_kl_penalty_coefficient,
              self.loss_weight,
          )
      elif isinstance(self.spaces.action, BoxActionSpace):
          loss = ClippedPPOLossContinuous(
              self.spaces.action.shape[0],
              self.clip_likelihood_ratio_using_epsilon,
              self.beta,
              self.use_kl_regularization,
              self.initial_kl_coefficient,
              self.kl_cutoff,
              self.high_kl_penalty_coefficient,
              self.loss_weight,
          )
      else:
          raise ValueError(
              "Only discrete or continuous action spaces are supported for PPO."
          )
      loss.initialize()
      # set a property so can assign_kl_coefficient in future,
      # make a list, otherwise it would be added as a child of Head Block (due to type check)
      self._loss = [loss]
      return loss
  
imports: from typing import List, Tuple, Union
  from types import ModuleType
  import math
  import mxnet
  from mxnet.gluon import nn
  from rl_coach.base_parameters import AgentParameters
  from rl_coach.core_types import ActionProbabilities
  from rl_coach.spaces import SpacesDefinition, BoxActionSpace, DiscreteActionSpace
  from rl_coach.utils import eps
  from rl_coach.architectures.mxnet_components.heads.head import Head, HeadLoss, LossInputSchema, NormalizedRSSInitializer
  from rl_coach.architectures.mxnet_components.heads.head import LOSS_OUT_TYPE_LOSS, LOSS_OUT_TYPE_REGULARIZATION
  from rl_coach.architectures.mxnet_components.utils import hybrid_clip, broadcast_like
label_desc: Use image node_id 3 for calling the PPOHead obj's underlying member method code with example usage: obj.loss() and returns: loss