code: def run_episode(env, agent, rpm):
      obs = env.reset()
      total_reward, steps = 0, 0
      while True:
          steps += 1
          batch_obs = np.expand_dims(obs, axis=0)
          action = agent.predict(batch_obs.astype("float32"))
          action = np.squeeze(action)
  
          # Add exploration noise, and clip to [-1.0, 1.0]
          action = np.clip(np.random.normal(action, 1.0), -1.0, 1.0)
  
          real_action = action_mapping(
              action, env.action_space.low[0], env.action_space.high[0]
          )
          next_obs, reward, done, info = env.step(real_action)
          rpm.append(obs, action, REWARD_SCALE * reward, next_obs, done)
  
          if rpm.size() > MEMORY_WARMUP_SIZE:
              (
                  batch_obs,
                  batch_action,
                  batch_reward,
                  batch_next_obs,
                  batch_terminal,
              ) = rpm.sample_batch(BATCH_SIZE)
              critic_cost = agent.learn(
                  batch_obs,
                  batch_action,
                  batch_reward,
                  batch_next_obs,
                  batch_terminal,
              )
  
          obs = next_obs
          total_reward += reward
  
          if done:
              break
      return total_reward, steps
  
file_path: PARL/examples/tutorials/homework/lesson5/ddpg_quadrotor/train.py
imports: import gym
  import parl
  import paddle
  import os
  import numpy
  import parl
  from parl import layers
  from paddle import fluid
  from parl.utils import logger
  from parl.utils import ReplayMemory
  from rlschool import make_env
  from quadrotor_model import QuadrotorModel
  from quadrotor_agent import QuadrotorAgent
  from parl.algorithms import DDPG
label_desc: Use image node_id 2 for calling a global function with example usage: run_episode(env, agent, rpm) and returns: total_reward,  steps