docstr: 根据观测值 obs 采样（带探索）一个动作
          
code: def sample(self, obs):
      """根据观测值 obs 采样（带探索）一个动作"""
      obs = paddle.to_tensor(obs, dtype="float32")
      prob = self.alg.predict(obs)
      prob = prob.numpy()
      act = np.random.choice(len(prob), 1, p=prob)[0]  # 根据动作概率选取动作
      return act
  
file_path: PARL/examples/tutorials/parl2_dygraph/lesson4/policy_gradient/agent.py
imports: import parl
  import paddle
  import numpy
label_desc: Use image node_id 2 for calling the Agent obj's underlying member method code with example usage: obj.sample(obs) and returns: act