docstr: Calculate value function loss.
          
docstr_tok: ["Calculate","value","function","loss","."]
code: def cal_value_loss(
      self,
      values,
      value_preds_batch,
      return_batch,
      active_masks_batch=None,
  ):
      """Calculate value function loss."""
      value_pred_clipped = value_preds_batch + (
          values - value_preds_batch
      ).clamp(-self.clip_param, self.clip_param)
  
      if self._use_popart:
          self.value_normalizer.update(return_batch)
          error_clipped = (
              self.value_normalizer.normalize(return_batch)
              - value_pred_clipped
          )
          error_original = (
              self.value_normalizer.normalize(return_batch) - values
          )
      else:
          error_clipped = return_batch - value_pred_clipped
          error_original = return_batch - values
  
      value_loss_clipped = huber_loss(error_clipped, self.huber_delta)
      value_loss_original = huber_loss(error_original, self.huber_delta)
  
      value_loss = torch.max(value_loss_original, value_loss_clipped)
  
      if self._use_value_active_masks:
          value_loss = (
              value_loss * active_masks_batch
          ).sum() / active_masks_batch.sum()
      else:
          value_loss = value_loss.mean()
  
      return value_loss
  
imports: import torch
  import torch.nn
  from torch.distributions import Categorical
  import numpy
  import parl
label_desc: Use image node_id 4 for calling the MAPPO obj's underlying member method code with example usage: obj.cal_value_loss(values, value_preds_batch, return_batch, active_masks_batch) and returns: value_loss