code: def run_train_episode(agent, env, rpm):
      total_reward = 0
      obs = env.reset()
      step = 0
      while True:
          step += 1
          action = agent.sample(obs)  # 采样动作，所有动作都有概率被尝试到
          next_obs, reward, done, _ = env.step(action)
          rpm.append((obs, action, reward, next_obs, done))
  
          # train model
          if (len(rpm) > MEMORY_WARMUP_SIZE) and (
              step % LEARN_FREQ == 0
          ):
              # s,a,r,s',done
              (
                  batch_obs,
                  batch_action,
                  batch_reward,
                  batch_next_obs,
                  batch_done,
              ) = rpm.sample(BATCH_SIZE)
              train_loss = agent.learn(
                  batch_obs,
                  batch_action,
                  batch_reward,
                  batch_next_obs,
                  batch_done,
              )
  
          total_reward += reward
          obs = next_obs
          if done:
              break
      return total_reward
  
file_path: PARL/examples/tutorials/parl2_dygraph/lesson3/homework/dqn_mountaincar/train.py
imports: import gym
  import parl
  import paddle
  import os
  import gym
  import numpy
  import parl
  from parl.utils import logger
  from model import Model
  from parl.algorithms import DQN
  from agent import Agent
  from replay_memory import ReplayMemory
label_desc: Use image node_id 1 for calling a global function with example usage: run_train_episode(agent, env, rpm) and returns: total_reward