code: def run_episode(env, agent, per, mem=None, warmup=False, train=False):
      total_reward = 0
      all_cost = []
      traj = deque(maxlen=CONTEXT_LEN)
      obs = env.reset()
      for _ in range(CONTEXT_LEN - 1):
          traj.append(np.zeros(obs.shape))
      steps = 0
      if warmup:
          decay_exploration = False
      else:
          decay_exploration = True
      while True:
          steps += 1
          traj.append(obs)
          context = np.stack(traj, axis=0)
          action = agent.sample(
              context, decay_exploration=decay_exploration
          )
          next_obs, reward, terminal, _ = env.step(action)
          transition = [obs, action, reward, next_obs, terminal]
          if warmup:
              mem.append(transition)
          if train:
              per.store(transition)
              if steps % UPDATE_FREQ == 0:
                  beta = get_beta()
                  transitions, idxs, sample_weights = per.sample(
                      beta=beta
                  )
                  batch = process_transitions(transitions)
  
                  cost, delta = agent.learn(*batch, sample_weights)
                  all_cost.append(cost)
                  per.update(idxs, delta)
  
          total_reward += reward
          obs = next_obs
          if terminal:
              break
  
      return total_reward, steps, np.mean(all_cost)
  
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 3 for calling a global function with example usage: run_episode(env, agent, per, mem, warmup, train) and returns: total_reward,  steps,  np