code: def main():
      env = gym.make("CartPole-v0")
      action_dim = env.action_space.n
      obs_shape = env.observation_space.shape
  
      rpm = ReplayMemory(MEMORY_SIZE)
  
      model = CartpoleModel(act_dim=action_dim)
      algorithm = parl.algorithms.DQN(
          model, act_dim=action_dim, gamma=GAMMA, lr=LEARNING_RATE
      )
      agent = CartpoleAgent(
          algorithm,
          obs_dim=obs_shape[0],
          act_dim=action_dim,
          e_greed=0.1,  # explore
          e_greed_decrement=1e-6,
      )  # probability of exploring is decreasing during training
  
      while len(rpm) < MEMORY_WARMUP_SIZE:  # warm up replay memory
          run_episode(agent, env, rpm)
  
      max_episode = 2000
  
      # start train
      episode = 0
      while episode < max_episode:
          # train part
          for i in range(0, 50):
              total_reward = run_episode(agent, env, rpm)
              episode += 1
  
          eval_reward = evaluate(agent, env)
          logger.info(
              "episode:{}    test_reward:{}".format(
                  episode, eval_reward
              )
          )
  
file_path: PARL/benchmark/fluid/DQN/train_with_xpu.py
imports: import os
  import gym
  import numpy
  import paddle
  import parl
  from parl.utils import logger, check_version_for_xpu
  from cartpole_model import CartpoleModel
  from cartpole_agent import CartpoleAgent
  from replay_memory import ReplayMemory
label_desc: Use image node_id 3 for calling a global function with example usage: main() without return types