code: def calc_reward_to_go(reward_list, gamma=1.0):
      for i in range(len(reward_list) - 2, -1, -1):
          # G_i = r_i + γ·G_i+1
          reward_list[i] += gamma * reward_list[i + 1]  # Gt
      return np.array(reward_list)
  
file_path: PARL/examples/tutorials/parl2_dygraph/lesson4/policy_gradient/train.py
imports: import gym
  import parl
  import paddle
  import os
  import gym
  import numpy
  import parl
  from agent import Agent
  from model import Model
  from algorithm import PolicyGradient
  from parl.utils import logger
label_desc: Use image node_id 3 for calling a global function with example usage: calc_reward_to_go(reward_list, gamma) and returns: np