code: def test_loss(self, mock_forward, mock_get_targets):
      num_rois = 16
      feature_maps = torch.randn((2, 10, 128, 128), dtype=torch.float)
      x = np.random.randint(4, 124, (num_rois, 1))
      y = np.random.randint(4, 124, (num_rois, 1))
      h = 4 * np.ones((num_rois, 1))
      w = 4 * np.ones((num_rois, 1))
      angle = (
          (np.random.random_sample((num_rois, 1)) * 2 - 1) * np.pi / 2
      )
      cos, sin = np.cos(angle), np.sin(angle)
      comp_labels = np.random.randint(1, 3, (num_rois, 1))
      num_rois = num_rois * np.ones((num_rois, 1))
      comp_attribs = np.hstack(
          [num_rois, x, y, h, w, cos, sin, comp_labels]
      )
      comp_attribs = comp_attribs.astype(np.float32)
      comp_attribs_ = comp_attribs.copy()
      comp_attribs = np.stack([comp_attribs, comp_attribs_])
      mock_get_targets.return_value = (
          None,
          None,
          None,
          None,
          None,
          None,
          None,
          comp_attribs,
      )
      mock_forward.side_effect = lambda *args: args[0]
      # It returns the tensor input to module loss
      pred_maps, pred_labels, gt_labels = self.drrg_head.loss(
          feature_maps, None
      )
      self.assertEqual(pred_maps.size(), (2, 6, 128, 128))
      self.assertTrue(pred_labels.ndim == gt_labels.ndim == 2)
      self.assertEqual(
          gt_labels.size()[0] * gt_labels.size()[1],
          pred_labels.size()[0],
      )
      self.assertEqual(pred_labels.size()[1], 2)
  
imports: from unittest import TestCase, mock
  import numpy
  import torch
  from mmocr.models.textdet.heads.drrg_head import GCN, DRRGHead, LocalGraphs, ProposalLocalGraphs, feature_embedding, normalize_adjacent_matrix
label_desc: Use image node_id 2 for calling the TestDRRGHead obj's underlying member method code with example usage: obj.test_loss(mock_forward, mock_get_targets) without return types