class_docstr: PPO class
class_docstr_tok: ["PPO","class"]
docstr: Calculate cumulative reward
  :param next_state:
  :return: None
docstr_tok: ["Calculate","cumulative","reward",":","param","next_state",":",":","return",":","None"]
code: def finish_path(self, next_state, done):
      """
      Calculate cumulative reward
      :param next_state:
      :return: None
      """
      if done:
          v_s_ = 0
      else:
          v_s_ = self.critic(np.array([next_state], np.float32))[0, 0]
      discounted_r = []
      for r in self.reward_buffer[::-1]:
          v_s_ = r + GAMMA * v_s_
          discounted_r.append(v_s_)
      discounted_r.reverse()
      discounted_r = np.array(discounted_r)[:, np.newaxis]
      self.cumulative_reward_buffer.extend(discounted_r)
      self.reward_buffer.clear()
  
file_path: TensorLayer/examples/reinforcement_learning/tutorial_PPO.py
imports: import argparse
  import os
  import time
  import gym
  import matplotlib.pyplot
  import numpy
  import tensorflow
  import tensorflow_probability
  import tensorlayer
label_desc: Use image node_id 9 for calling the PPO obj's underlying member method code with example usage: obj.finish_path(next_state, done) without return types