code: def main():
      logger.info("------------------ DDPG ---------------------")
      logger.info("Env: {}, Seed: {}".format(args.env, args.seed))
      logger.info("---------------------------------------------")
  
      env = gym.make(args.env)
      # Compatible for different versions of gym
      env = CompatWrapper(env)
      env = ActionMappingWrapper(env)
      env.seed(args.seed)
      obs_dim = env.observation_space.shape[0]
      action_dim = env.action_space.shape[0]
  
      # Initialize model, algorithm, agent, replay_memory
      model = MujocoModel(obs_dim, action_dim)
      algorithm = DDPG(
          model,
          gamma=GAMMA,
          tau=TAU,
          actor_lr=ACTOR_LR,
          critic_lr=CRITIC_LR,
      )
      agent = MujocoAgent(algorithm, action_dim, expl_noise=EXPL_NOISE)
      rpm = ReplayMemory(
          max_size=MEMORY_SIZE, obs_dim=obs_dim, act_dim=action_dim
      )
  
      total_steps = 0
      test_flag = 0
  
      while total_steps < args.train_total_steps:
          # Train episode
          episode_reward, episode_steps = run_train_episode(
              agent, env, rpm
          )
          total_steps += episode_steps
  
          summary.add_scalar(
              "train/episode_reward", episode_reward, total_steps
          )
          logger.info(
              "Total Steps: {} Reward: {}".format(
                  total_steps, episode_reward
              )
          )
  
          # Evaluate episode
          if (total_steps + 1) // args.test_every_steps >= test_flag:
              while (
                  total_steps + 1
              ) // args.test_every_steps >= test_flag:
                  test_flag += 1
              avg_reward = run_evaluate_episodes(
                  agent, env, EVAL_EPISODES
              )
              summary.add_scalar(
                  "eval/episode_reward", avg_reward, total_steps
              )
              logger.info(
                  "Evaluation over: {} episodes, Reward: {}".format(
                      EVAL_EPISODES, avg_reward
                  )
              )
  
file_path: PARL/benchmark/torch/ddpg/train.py
imports: import numpy
  import gym
  import argparse
  from parl.utils import logger, summary, ReplayMemory
  from parl.env import ActionMappingWrapper, CompatWrapper
  from mujoco_model import MujocoModel
  from mujoco_agent import MujocoAgent
  from parl.algorithms import DDPG
label_desc: Use image node_id 3 for calling a global function with example usage: main() without return types