code: def test_single_stage_forward_tensor_mode(self, cfg_file, devices):
      model = get_detector_cfg(cfg_file)
      model.backbone.init_cfg = None
  
      from mmdet.registry import MODELS
  
      assert all([device in ["cpu", "cuda"] for device in devices])
  
      for device in devices:
          detector = MODELS.build(model)
  
          if device == "cuda":
              if not torch.cuda.is_available():
                  return unittest.skip(
                      "test requires GPU and torch+cuda"
                  )
              detector = detector.cuda()
  
          packed_inputs = demo_mm_inputs(
              2, [[3, 128, 128], [3, 125, 130]]
          )
          data = detector.data_preprocessor(packed_inputs, False)
          batch_results = detector.forward(**data, mode="tensor")
          self.assertIsInstance(batch_results, tuple)
  
file_path: mmdetection/tests/test_models/test_detectors/test_single_stage_instance_seg.py
imports: import unittest
  from unittest import TestCase
  import torch
  from parameterized import parameterized
  from mmdet.structures import DetDataSample
  from mmdet.testing import demo_mm_inputs, get_detector_cfg
  from mmdet.utils import register_all_modules
label_desc: Use image node_id 5 for calling the TestSingleStageInstanceSegmentor obj's underlying member method code with example usage: obj.test_single_stage_forward_tensor_mode(cfg_file, devices) and returns: unittest