docstr: update value model self.model with DQN algorithm
          
docstr_tok: ["update","value","model","self.model","with","DQN","algorithm"]
code: def learn(
      self, obs, action, reward, next_obs, terminal, sample_weight
  ):
      """update value model self.model with DQN algorithm"""
  
      pred_value = self.model.value(obs)
      next_pred_value = self.target_model.value(next_obs)
      best_v = layers.reduce_max(next_pred_value, dim=1)
      best_v.stop_gradient = True
      target = (
          reward
          + (1.0 - layers.cast(terminal, dtype="float32"))
          * self.gamma
          * best_v
      )
  
      action_onehot = layers.one_hot(action, self.act_dim)
      action_onehot = layers.cast(action_onehot, dtype="float32")
      pred_action_value = layers.reduce_sum(
          action_onehot * pred_value, dim=1
      )
      delta = layers.abs(target - pred_action_value)
      cost = sample_weight * layers.square_error_cost(
          pred_action_value, target
      )
      cost = layers.reduce_mean(cost)
      optimizer = fluid.optimizer.Adam(
          learning_rate=self.lr, epsilon=1e-3
      )
      optimizer.minimize(cost)
      return cost, delta
  
file_path: PARL/benchmark/fluid/Prioritized_DQN/per_alg.py
imports: import copy
  import numpy
  import paddle.fluid
  import parl
  from parl.core.fluid import layers
label_desc: Use image node_id 3 for calling the PrioritizedDQN obj's underlying member method code with example usage: obj.learn(obs, action, reward, next_obs, terminal, sample_weight) and returns: cost,  delta