code: def main():
      env = get_player(
          args.rom,
          image_size=IMAGE_SIZE,
          train=True,
          frame_skip=FRAME_SKIP,
      )
      test_env = get_player(
          args.rom,
          image_size=IMAGE_SIZE,
          frame_skip=FRAME_SKIP,
          context_len=CONTEXT_LEN,
      )
      rpm = ReplayMemory(MEMORY_SIZE, IMAGE_SIZE, CONTEXT_LEN)
      act_dim = env.action_space.n
  
      model = AtariModel(act_dim, args.algo)
      if args.algo == "DDQN":
          algorithm = parl.algorithms.DDQN(
              model, act_dim=act_dim, gamma=GAMMA
          )
      elif args.algo in ["DQN", "Dueling"]:
          algorithm = parl.algorithms.DQN(
              model, act_dim=act_dim, gamma=GAMMA
          )
      agent = AtariAgent(
          algorithm,
          act_dim=act_dim,
          start_lr=LEARNING_RATE,
          total_step=args.train_total_steps,
          update_freq=UPDATE_FREQ,
      )
  
      with tqdm(
          total=MEMORY_WARMUP_SIZE, desc="[Replay Memory Warm Up]"
      ) as pbar:
          while rpm.size() < MEMORY_WARMUP_SIZE:
              total_reward, steps, _ = run_train_episode(
                  env, agent, rpm
              )
              pbar.update(steps)
  
      # train
      test_flag = 0
      pbar = tqdm(total=args.train_total_steps)
      total_steps = 0
      max_reward = None
      while total_steps < args.train_total_steps:
          # start epoch
          total_reward, steps, loss = run_train_episode(env, agent, rpm)
          total_steps += steps
          pbar.set_description(
              "[train]exploration:{}".format(agent.exploration)
          )
          summary.add_scalar("dqn/score", total_reward, total_steps)
          summary.add_scalar(
              "dqn/loss", loss, total_steps
          )  # mean of total loss
          summary.add_scalar(
              "dqn/exploration", agent.exploration, total_steps
          )
          pbar.update(steps)
  
          if total_steps // args.test_every_steps >= test_flag:
              while total_steps // args.test_every_steps >= test_flag:
                  test_flag += 1
              pbar.write("testing")
              eval_rewards = []
              for _ in tqdm(range(3), desc="eval agent"):
                  eval_reward = run_evaluate_episode(test_env, agent)
                  eval_rewards.append(eval_reward)
              logger.info(
                  "eval_agent done, (steps, eval_reward): ({}, {})".format(
                      total_steps, np.mean(eval_rewards)
                  )
              )
              eval_test = np.mean(eval_rewards)
              summary.add_scalar("dqn/eval", eval_test, total_steps)
  
      pbar.close()
  
file_path: PARL/benchmark/fluid/DQN_variant/train.py
imports: from parl.utils import check_version_for_fluid
  import argparse
  import gym
  import paddle.fluid
  import numpy
  import os
  import parl
  from atari_agent import AtariAgent
  from atari_model import AtariModel
  from datetime import datetime
  from replay_memory import ReplayMemory, Experience
  from parl.utils import summary, logger
  from tqdm import tqdm
  from utils import get_player
label_desc: Use image node_id 3 for calling a global function with example usage: main() without return types