code: def test_process(self):
      metric = DumpDetResults(out_file_path="./results.pkl")
      data_samples = [dict(data=(Tensor([1, 2, 3]), Tensor([4, 5, 6])))]
      metric.process(None, data_samples)
      self.assertEqual(len(metric.results), 1)
      self.assertEqual(
          metric.results[0]["data"][0].device, torch.device("cpu")
      )
  
      metric = DumpDetResults(out_file_path="./results.pkl")
      masks = torch.zeros(10, 10, 4)
      data_samples = [
          dict(pred_instances=dict(masks=masks), gt_instances=[])
      ]
      metric.process(None, data_samples)
      self.assertEqual(len(metric.results), 1)
      self.assertEqual(
          metric.results[0]["pred_instances"]["masks"],
          encode_mask_results(masks.numpy()),
      )
      self.assertNotIn("gt_instances", metric.results[0])
  
file_path: mmdetection/tests/test_evaluation/test_metrics/test_dump_det_results.py
imports: import os.path
  import tempfile
  from unittest import TestCase
  import torch
  from mmengine.fileio import load
  from torch import Tensor
  from mmdet.evaluation import DumpDetResults
  from mmdet.structures.mask import encode_mask_results
label_desc: Use image node_id 2 for calling the TestDumpResults obj's underlying member method code with example usage: obj.test_process() without return types