code: def build_train_data(trajectories, agent):
      (
          train_obs,
          train_actions,
          train_advantages,
          train_discount_sum_rewards,
      ) = ([], [], [], [])
      for trajectory in trajectories:
          pred_values = agent.value_predict(trajectory["obs"])
  
          # scale rewards
          scale_rewards = trajectory["rewards"] * (1 - args.gamma)
  
          discount_sum_rewards = calc_discount_sum_rewards(
              scale_rewards, args.gamma
          ).astype("float32")
  
          advantages = calc_gae(
              scale_rewards, pred_values, 0, args.gamma, args.lam
          )
  
          # normalize advantages
          advantages = (advantages - advantages.mean()) / (
              advantages.std() + 1e-6
          )
          advantages = advantages.astype("float32")
  
          train_obs.append(trajectory["obs"])
          train_actions.append(trajectory["actions"])
          train_advantages.append(advantages)
          train_discount_sum_rewards.append(discount_sum_rewards)
  
      train_obs = np.concatenate(train_obs)
      train_actions = np.concatenate(train_actions)
      train_advantages = np.concatenate(train_advantages)
      train_discount_sum_rewards = np.concatenate(
          train_discount_sum_rewards
      )
  
      return (
          train_obs,
          train_actions,
          train_advantages,
          train_discount_sum_rewards,
      )
  
file_path: PARL/benchmark/fluid/PPO/train.py
imports: from parl.utils import check_version_for_fluid
  import argparse
  import gym
  import numpy
  import parl
  from mujoco_agent import MujocoAgent
  from mujoco_model import MujocoModel
  from parl.utils import logger
  from parl.utils.rl_utils import calc_gae, calc_discount_sum_rewards
  from parl.env.continuous_wrappers import ActionMappingWrapper
  from scaler import Scaler
label_desc: Use image node_id 4 for calling a global function with example usage: build_train_data(trajectories, agent) and returns: train_obs,  train_actions,  train_advantages,  train_discount_sum_rewards