docstr: use self.model to get squared Bellman residual with fed data
          
docstr_tok: ["use","self.model","to","get","squared","Bellman","residual","with","fed","data"]
code: def cal_bellman_residual(
      self, obs, action, reward, next_obs, terminal
  ):
      """use self.model to get squared Bellman residual with fed data"""
      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(
          layers.elementwise_mul(action_onehot, pred_value), dim=1
      )
      cost = layers.square_error_cost(pred_action_value, target)
      cost = layers.reduce_mean(cost)
      return cost
  
file_path: PARL/benchmark/fluid/offline-Q-learning/dqn.py
imports: import warnings
  import copy
  import paddle.fluid
  from parl.core.fluid.algorithm import Algorithm
  from parl.core.fluid import layers
label_desc: Use image node_id 5 for calling the DQN obj's underlying member method code with example usage: obj.cal_bellman_residual(obs, action, reward, next_obs, terminal) and returns: cost