class_docstr: Agent of PPO env
  
  Args:
      algorithm (`parl.Algorithm`): algorithm to be used in this agent.
      config (dict): configs that used in this agent
class_docstr_tok: ["Agent","of","PPO","env","Args",":","algorithm","(","`","parl.Algorithm","`",")",":","algorithm","to","be","used","in","this","agent",".","config","(","dict",")",":","configs","that","used","in","this","agent"]
docstr: Learn current batch of rollout for ppo_epoch epochs.
  
  Args:
      rollouts (RolloutStorage): the rollout storage that contains the current rollout
docstr_tok: ["Learn","current","batch","of","rollout","for","ppo_epoch","epochs",".","Args",":","rollouts","(","RolloutStorage",")",":","the","rollout","storage","that","contains","the","current","rollout"]
code: def learn(self, rollout):
      """Learn current batch of rollout for ppo_epoch epochs.
  
      Args:
          rollouts (RolloutStorage): the rollout storage that contains the current rollout
      """
      value_loss_epoch = 0
      action_loss_epoch = 0
      entropy_loss_epoch = 0
      if self.config["lr_decay"]:
          lr = self.lr_scheduler.step(step_num=1)
      else:
          lr = None
  
      minibatch_size = int(
          self.config["batch_size"] // self.config["num_minibatches"]
      )
  
      indexes = np.arange(self.config["batch_size"])
      for epoch in range(self.config["update_epochs"]):
          np.random.shuffle(indexes)
          for start in range(
              0, self.config["batch_size"], minibatch_size
          ):
              end = start + minibatch_size
              sample_idx = indexes[start:end]
  
              (
                  batch_obs,
                  batch_action,
                  batch_logprob,
                  batch_adv,
                  batch_return,
                  batch_value,
              ) = rollout.sample_batch(sample_idx)
  
              batch_obs = paddle.to_tensor(batch_obs)
              batch_action = paddle.to_tensor(batch_action)
              batch_logprob = paddle.to_tensor(batch_logprob)
              batch_adv = paddle.to_tensor(batch_adv)
              batch_return = paddle.to_tensor(batch_return)
              batch_value = paddle.to_tensor(batch_value)
  
              value_loss, action_loss, entropy_loss = self.alg.learn(
                  batch_obs,
                  batch_action,
                  batch_value,
                  batch_return,
                  batch_logprob,
                  batch_adv,
                  lr,
              )
  
              value_loss_epoch += value_loss
              action_loss_epoch += action_loss
              entropy_loss_epoch += entropy_loss
  
      update_steps = (
          self.config["update_epochs"] * self.config["batch_size"]
      )
      value_loss_epoch /= update_steps
      action_loss_epoch /= update_steps
      entropy_loss_epoch /= update_steps
  
      return value_loss_epoch, action_loss_epoch, entropy_loss_epoch, lr
  
file_path: PARL/examples/PPO/agent.py
imports: import parl
  import paddle
  import numpy
  from parl.utils.scheduler import LinearDecayScheduler
label_desc: Use image node_id 5 for calling the PPOAgent obj's underlying member method code with example usage: obj.learn(rollout) and returns: value_loss_epoch,  action_loss_epoch,  entropy_loss_epoch,  lr