docstr: PPO algorithm for discrete actions by paddlepaddle
  Args:
      actor (parl.Model): actor network
      critic (parl.Model): critic network
      clip_param (float): param for clipping the importance sampling ratio
      value_loss_coef (float): coefficient for value loss
      entropy_coef (float): coefficient for entropy
      initial_lr (float): learning rate
      max_grad_norm (int): to clip the gradient of network
      use_clipped_value_loss: whether to clip the value loss
docstr_tok: ["PPO","algorithm","for","discrete","actions","by","paddlepaddle","Args",":","actor","(","parl.Model",")",":","actor","network","critic","(","parl.Model",")",":","critic","network","clip_param","(","float",")",":","param","for","clipping","the","importance","sampling","ratio","value_loss_coef","(","float",")",":","coefficient","for","value","loss","entropy_coef","(","float",")",":","coefficient","for","entropy","initial_lr","(","float",")",":","learning","rate","max_grad_norm","(","int",")",":","to","clip","the","gradient","of","network","use_clipped_value_loss",":","whether","to","clip","the","value","loss"]
code: def __init__(
      self,
      actor,
      critic,
      clip_param,
      value_loss_coef,
      entropy_coef,
      initial_lr,
      eps=None,
      max_grad_norm=None,
      use_clipped_value_loss=False,
  ):
      """PPO algorithm for discrete actions by paddlepaddle
      Args:
          actor (parl.Model): actor network
          critic (parl.Model): critic network
          clip_param (float): param for clipping the importance sampling ratio
          value_loss_coef (float): coefficient for value loss
          entropy_coef (float): coefficient for entropy
          initial_lr (float): learning rate
          max_grad_norm (int): to clip the gradient of network
          use_clipped_value_loss: whether to clip the value loss
      """
      self.actor = actor
      self.critic = critic
      self.clip_param = clip_param
      self.value_loss_coef = value_loss_coef
      self.entropy_coef = entropy_coef
      self.max_grad_norm = max_grad_norm
      self.use_clipped_value_loss = use_clipped_value_loss
  
      self.critic_optimizer = optim.Adam(
          self.critic.parameters(), lr=initial_lr
      )
      self.actor_optimizer = optim.Adam(
          self.actor.parameters(), lr=initial_lr
      )
  
file_path: PARL/examples/Baselines/Halite_competition/torch/rl_trainer/algorithm.py
imports: import torch
  import torch.nn
  import torch.optim
  import parl
  from torch.distributions import Categorical
label_desc: Use image node_id 1 to create a new PPO object from inherited base classes: parl with example: obj = PPO(actor, critic, clip_param, value_loss_coef, entropy_coef, initial_lr, eps, max_grad_norm, use_clipped_value_loss)