code: def test_forward(self):
      # Shape mismatch between pred and gt
      with self.assertRaises(AssertionError):
          invalid_gt = torch.FloatTensor([0, 0, 0])
          self.loss(self.pred, invalid_gt)
  
      # Shape mismatch between pred and mask
      with self.assertRaises(AssertionError):
          invalid_mask = torch.BoolTensor([True, False, False])
          self.loss(self.pred, self.gt, invalid_mask)
  
      self.assertAlmostEqual(
          self.loss(self.pred, self.gt).item(), 1 / 3, delta=0.001
      )
      self.assertAlmostEqual(
          self.loss(self.pred, self.gt, self.mask).item(),
          1 / 5,
          delta=0.001,
      )
  
      # Test zero mask
      zero_mask = torch.FloatTensor([0, 0, 0, 0])
      self.assertAlmostEqual(
          self.loss(self.pred, self.gt, zero_mask).item(), 1
      )
  
file_path: mmocr/tests/test_models/test_common/test_losses/test_dice_loss.py
imports: from unittest import TestCase
  import torch
  from mmocr.models.common.losses import MaskedDiceLoss, MaskedSquareDiceLoss
label_desc: Use image node_id 3 for calling the TestMaskedDiceLoss obj's underlying member method code with example usage: obj.test_forward() without return types