class_docstr: PG class
docstr: compute discount_and_norm_rewards
  :return: discount_and_norm_rewards
docstr_tok: ["compute","discount_and_norm_rewards",":","return",":","discount_and_norm_rewards"]
code: def _discount_and_norm_rewards(self):
      """
      compute discount_and_norm_rewards
      :return: discount_and_norm_rewards
      """
      # discount episode rewards
      discounted_reward_buffer = np.zeros_like(self.reward_buffer)
      running_add = 0
      for t in reversed(range(0, len(self.reward_buffer))):
          running_add = running_add * self.gamma + self.reward_buffer[t]
          discounted_reward_buffer[t] = running_add
  
      # normalize episode rewards
      discounted_reward_buffer -= np.mean(discounted_reward_buffer)
      discounted_reward_buffer /= np.std(discounted_reward_buffer)
      return discounted_reward_buffer
  
file_path: TensorLayer/examples/reinforcement_learning/tutorial_PG.py
imports: import argparse
  import os
  import time
  import gym
  import matplotlib.pyplot
  import numpy
  import tensorflow
  import tensorlayer
label_desc: Use image node_id 5 for calling the PolicyGradient obj's underlying member method code with example usage: obj._discount_and_norm_rewards() and returns: discounted_reward_buffer