code: def main():
      env = make_env("Quadrotor", task="hovering_control")
      env = ActionMappingWrapper(env)
      env.reset()
      obs_dim = env.observation_space.shape[0]
      act_dim = env.action_space.shape[0]
  
      obs_dim = env.observation_space.shape[0]
      action_dim = env.action_space.shape[0]
  
      # Initialize model, algorithm, agent, replay_memory
      model = QuadrotorModel(obs_dim, action_dim)
      algorithm = DDPG(
          model,
          gamma=GAMMA,
          tau=TAU,
          actor_lr=ACTOR_LR,
          critic_lr=CRITIC_LR,
      )
      agent = QuadrotorAgent(
          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
  
          tensorboard.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, render=False
              )
              tensorboard.add_scalar(
                  "eval/episode_reward", avg_reward, total_steps
              )
              logger.info(
                  "Evaluation over: {} episodes, Reward: {}".format(
                      EVAL_EPISODES, avg_reward
                  )
              )
  
file_path: PARL/examples/tutorials/parl2_dygraph/lesson5/homework/ddpg_quadrotor/train.py
imports: import gym
  import parl
  import paddle
  import argparse
  import numpy
  from parl.utils import logger, tensorboard, ReplayMemory
  from quadrotor_model import QuadrotorModel
  from quadrotor_agent import QuadrotorAgent
  from parl.algorithms import DDPG
  from rlschool import make_env
  import paddle
label_desc: Use image node_id 3 for calling a global function with example usage: main() without return types