code: def test_point_rend_roi_head_predict(self, cfg_file):
      if not torch.cuda.is_available():
          # RoI pooling only support in GPU
          return unittest.skip("test requires GPU and torch+cuda")
      s = 256
      img_metas = [
          {
              "img_shape": (s, s, 3),
              "scale_factor": 1,
          }
      ]
      roi_head_cfg = get_roi_head_cfg(cfg_file)
      roi_head = MODELS.build(roi_head_cfg)
      roi_head = roi_head.cuda()
      feats = []
      for i in range(
          len(roi_head_cfg.bbox_roi_extractor.featmap_strides)
      ):
          feats.append(
              torch.rand(
                  1, 256, s // (2 ** (i + 2)), s // (2 ** (i + 2))
              ).to(device="cuda")
          )
      feats = tuple(feats)
  
      img_shape_list = [img_meta["img_shape"] for img_meta in img_metas]
      proposal_list = demo_mm_proposals(
          img_shape_list, 100, device="cuda"
      )
      batch_data_samples = demo_mm_inputs(
          batch_size=1,
          image_shapes=[(3, s, s)],
          num_items=[1],
          num_classes=4,
          with_mask=True,
          device="cuda",
      )["data_samples"]
      results = roi_head.predict(
          feats, proposal_list, batch_data_samples, rescale=True
      )
      self.assertEqual(results[0].masks.shape[-2:], (s, s))
  
file_path: mmdetection/tests/test_models/test_roi_heads/test_point_rend_roi_head.py
imports: import unittest
  from unittest import TestCase
  import torch
  from parameterized import parameterized
  from mmdet.models.roi_heads import PointRendRoIHead
  from mmdet.registry import MODELS
  from mmdet.testing import demo_mm_inputs, demo_mm_proposals, get_roi_head_cfg
label_desc: Use image node_id 3 for calling the TestHTCRoIHead obj's underlying member method code with example usage: obj.test_point_rend_roi_head_predict(cfg_file) and returns: unittest