code: def test_process_empty_roi():
      batch_size = 2
      batch_img_metas = [{"ori_shape": (10, 12)}] * batch_size
      device = torch.device("cpu")
  
      results_list = empty_instances(
          batch_img_metas, device, task_type="bbox"
      )
      assert len(results_list) == batch_size
      for results in results_list:
          assert isinstance(results, InstanceData)
          assert len(results) == 0
          assert torch.allclose(
              results.bboxes, torch.zeros(0, 4, device=device)
          )
  
      results_list = empty_instances(
          batch_img_metas,
          device,
          task_type="mask",
          instance_results=results_list,
          mask_thr_binary=0.5,
      )
      assert len(results_list) == batch_size
      for results in results_list:
          assert isinstance(results, InstanceData)
          assert len(results) == 0
          assert results.masks.shape == (0, 10, 12)
  
      # batch_img_metas and instance_results length must be the same
      with pytest.raises(AssertionError):
          empty_instances(
              batch_img_metas,
              device,
              task_type="mask",
              instance_results=[results_list[0]] * 3,
          )
  
file_path: mmdetection/tests/test_models/test_utils/test_misc.py
imports: import copy
  import pytest
  import torch
  from mmengine.structures import InstanceData
  from mmdet.models.utils import empty_instances, filter_gt_instances, rename_loss_dict, reweight_loss_dict, unpack_gt_instances
  from mmdet.testing import demo_mm_inputs
label_desc: Use image node_id 2 for calling a global function with example usage: test_process_empty_roi() without return types