code: def dice_loss_helper(logit, label, mask, smooth, eps):
      assert (
          logit.shape == label.shape
      ), "The shape of logit and label should be the same"
      logit = paddle.reshape(logit, [0, -1])
      label = paddle.reshape(label, [0, -1])
      mask = paddle.reshape(mask, [0, -1])
      logit *= mask
      label *= mask
      intersection = paddle.sum(logit * label, axis=1)
      cardinality = paddle.sum(logit + label, axis=1)
      dice_loss = 1 - (2 * intersection + smooth) / (
          cardinality + smooth + eps
      )
      dice_loss = dice_loss.mean()
      return dice_loss
  
file_path: PaddleSeg/paddleseg/models/losses/dice_loss.py
imports: import paddle
  from paddle import nn
  import paddle.nn.functional
  from paddleseg.cvlibs import manager
label_desc: Use image node_id 1 for calling a global function with example usage: dice_loss_helper(logit, label, mask, smooth, eps) and returns: dice_loss