code: def main():
      # Prepare environments
      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,
      )
  
      # Init Prioritized Replay Memory
      per = ProportionalPER(
          alpha=0.6, seg_num=args.batch_size, size=MEMORY_SIZE
      )
  
      # Prepare PARL agent
      act_dim = env.action_space.n
      model = AtariModel(act_dim)
      if args.alg == "ddqn":
          algorithm = PrioritizedDoubleDQN(
              model, act_dim=act_dim, gamma=GAMMA, lr=LEARNING_RATE
          )
      elif args.alg == "dqn":
          algorithm = PrioritizedDQN(
              model, act_dim=act_dim, gamma=GAMMA, lr=LEARNING_RATE
          )
      agent = AtariAgent(
          algorithm, act_dim=act_dim, update_freq=UPDATE_FREQ
      )
  
      # Replay memory warmup
      total_step = 0
      with tqdm(
          total=MEMORY_SIZE, desc="[Replay Memory Warm Up]"
      ) as pbar:
          mem = []
          while total_step < MEMORY_WARMUP_SIZE:
              total_reward, steps, _ = run_episode(
                  env, agent, per, mem=mem, warmup=True
              )
              total_step += steps
              pbar.update(steps)
      per.elements.from_list(mem[: int(MEMORY_WARMUP_SIZE)])
  
      env_name = args.rom.split("/")[-1].split(".")[0]
  
      test_flag = 0
      total_steps = 0
      pbar = tqdm(total=args.train_total_steps)
      while total_steps < args.train_total_steps:
          # start epoch
          total_reward, steps, loss = run_episode(
              env, agent, per, train=True
          )
          total_steps += steps
          pbar.set_description(
              "[train]exploration:{}".format(agent.exploration)
          )
          summary.add_scalar(
              "{}/score".format(env_name), total_reward, total_steps
          )
          summary.add_scalar(
              "{}/loss".format(env_name), loss, total_steps
          )  # mean of total loss
          summary.add_scalar(
              "{}/exploration".format(env_name),
              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")
              test_rewards = []
              for _ in tqdm(range(3), desc="eval agent"):
                  eval_reward = run_evaluate_episode(test_env, agent)
                  test_rewards.append(eval_reward)
              eval_reward = np.mean(test_rewards)
              logger.info(
                  "eval_agent done, (steps, eval_reward): ({}, {})".format(
                      total_steps, eval_reward
                  )
              )
              summary.add_scalar(
                  "{}/eval".format(env_name), eval_reward, total_steps
              )
  
      pbar.close()
  
imports: from parl.utils import check_version_for_fluid
  import argparse
  import os
  import pickle
  from collections import deque
  from datetime import datetime
  import gym
  import numpy
  import paddle.fluid
  from tqdm import tqdm
  import parl
  from atari_agent import AtariAgent
  from atari_model import AtariModel
  from parl.utils import logger, summary
  from per_alg import PrioritizedDoubleDQN, PrioritizedDQN
  from proportional_per import ProportionalPER
  from utils import get_player
label_desc: Use image node_id 5 for calling a global function with example usage: main() without return types