docstr: Loss for discrete version of Clipped PPO.
  
  :param num_actions: number of actions in action space.
  :param clip_likelihood_ratio_using_epsilon: epsilon to use for likelihood ratio clipping.
  :param beta: loss coefficient applied to entropy
  :param use_kl_regularization: option to add kl divergence loss
  :param initial_kl_coefficient: loss coefficient applied kl divergence loss (also see high_kl_penalty_coefficient).
  :param kl_cutoff: threshold for using high_kl_penalty_coefficient
  :param high_kl_penalty_coefficient: loss coefficient applied to kv divergence above kl_cutoff
  :param weight: scalar used to adjust relative weight of loss (if using this loss with others).
  :param batch_axis: axis used for mini-batch (default is 0) and excluded from loss aggregation.
docstr_tok: ["Loss","for","discrete","version","of","Clipped","PPO",".",":","param","num_actions",":","number","of","actions","in","action","space",".",":","param","clip_likelihood_ratio_using_epsilon",":","epsilon","to","use","for","likelihood","ratio","clipping",".",":","param","beta",":","loss","coefficient","applied","to","entropy",":","param","use_kl_regularization",":","option","to","add","kl","divergence","loss",":","param","initial_kl_coefficient",":","loss","coefficient","applied","kl","divergence","loss","(","also","see","high_kl_penalty_coefficient",")",".",":","param","kl_cutoff",":","threshold","for","using","high_kl_penalty_coefficient",":","param","high_kl_penalty_coefficient",":","loss","coefficient","applied","to","kv","divergence","above","kl_cutoff",":","param","weight",":","scalar","used","to","adjust","relative","weight","of","loss","(","if","using","this","loss","with","others",")",".",":","param","batch_axis",":","axis","used","for","mini-batch","(","default","is","0",")","and","excluded","from","loss","aggregation","."]
code: def __init__(
      self,
      num_actions: int,
      clip_likelihood_ratio_using_epsilon: float,
      beta: float = 0,
      use_kl_regularization: bool = False,
      initial_kl_coefficient: float = 1,
      kl_cutoff: float = 0,
      high_kl_penalty_coefficient: float = 1,
      weight: float = 1,
      batch_axis: int = 0,
  ) -> None:
      """
      Loss for discrete version of Clipped PPO.
  
      :param num_actions: number of actions in action space.
      :param clip_likelihood_ratio_using_epsilon: epsilon to use for likelihood ratio clipping.
      :param beta: loss coefficient applied to entropy
      :param use_kl_regularization: option to add kl divergence loss
      :param initial_kl_coefficient: loss coefficient applied kl divergence loss (also see high_kl_penalty_coefficient).
      :param kl_cutoff: threshold for using high_kl_penalty_coefficient
      :param high_kl_penalty_coefficient: loss coefficient applied to kv divergence above kl_cutoff
      :param weight: scalar used to adjust relative weight of loss (if using this loss with others).
      :param batch_axis: axis used for mini-batch (default is 0) and excluded from loss aggregation.
      """
      super(ClippedPPOLossDiscrete, self).__init__(
          weight=weight, batch_axis=batch_axis
      )
      self.weight = weight
      self.num_actions = num_actions
      self.clip_likelihood_ratio_using_epsilon = (
          clip_likelihood_ratio_using_epsilon
      )
      self.beta = beta
      self.use_kl_regularization = use_kl_regularization
      self.initial_kl_coefficient = (
          initial_kl_coefficient if self.use_kl_regularization else 0.0
      )
      self.kl_coefficient = self.params.get(
          "kl_coefficient",
          shape=(1,),
          init=mx.init.Constant(
              [
                  initial_kl_coefficient,
              ]
          ),
          differentiable=False,
      )
      self.kl_cutoff = kl_cutoff
      self.high_kl_penalty_coefficient = high_kl_penalty_coefficient
  
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 1 to create a new ClippedPPOLossDiscrete object from inherited base classes: HeadLoss with example: obj = ClippedPPOLossDiscrete(num_actions, clip_likelihood_ratio_using_epsilon, beta, use_kl_regularization, initial_kl_coefficient, kl_cutoff, high_kl_penalty_coefficient, weight, batch_axis)