class_docstr: PG class
code: def __init__(
      self, state_dim, action_num, learning_rate=0.02, gamma=0.99
  ):
      self.gamma = gamma
  
      self.state_buffer, self.action_buffer, self.reward_buffer = (
          [],
          [],
          [],
      )
  
      input_layer = tl.layers.Input([None, state_dim], tf.float32)
      layer = tl.layers.Dense(
          n_units=30,
          act=tf.nn.tanh,
          W_init=tf.random_normal_initializer(mean=0, stddev=0.3),
          b_init=tf.constant_initializer(0.1),
      )(input_layer)
      all_act = tl.layers.Dense(
          n_units=action_num,
          act=None,
          W_init=tf.random_normal_initializer(mean=0, stddev=0.3),
          b_init=tf.constant_initializer(0.1),
      )(layer)
  
      self.model = tl.models.Model(inputs=input_layer, outputs=all_act)
      self.model.train()
      self.optimizer = tf.optimizers.Adam(learning_rate)
  
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 1 to create a new PolicyGradient object  with example: obj = PolicyGradient(state_dim, action_num, learning_rate, gamma)