docstr: 用policy gradient 算法更新policy model
          
docstr_tok: ["\u7528policy","gradient","\u7b97\u6cd5\u66f4\u65b0policy","model"]
code: def learn(self, obs, action, reward):
      """用policy gradient 算法更新policy model"""
      act_prob = self.model(obs)  # 获取输出动作概率
      # log_prob = layers.cross_entropy(act_prob, action) # 交叉熵
      log_prob = layers.reduce_sum(
          -1.0
          * layers.log(act_prob)
          * layers.one_hot(action, act_prob.shape[1]),
          dim=1,
      )
      cost = log_prob * reward
      cost = layers.reduce_mean(cost)
  
      optimizer = fluid.optimizer.Adam(self.lr)
      optimizer.minimize(cost)
      return cost
  
file_path: PARL/examples/tutorials/lesson4/policy_gradient/algorithm.py
imports: import paddle.fluid
  import parl
  from parl import layers
label_desc: Use image node_id 3 for calling the PolicyGradient obj's underlying member method code with example usage: obj.learn(obs, action, reward) and returns: cost