code: def collect_tracking_results(
      results: list, device: str = "cpu", tmpdir: Optional[str] = None
  ) -> Optional[list]:
      """Collected results in distributed environments. different from the
      function mmengine.dist.collect_results, tracking compute metrics don't use
      paramenter size, which means length of the entire validation dataset.
      because it's equal to video num, but compute metrics need image num.
  
      Args:
          results (list): Result list containing result parts to be
              collected. Each item of ``result_part`` should be a picklable
              object.
          device (str): Device name. Optional values are 'cpu' and 'gpu'.
          tmpdir (str | None): Temporal directory for collected results to
              store. If set to None, it will create a temporal directory for it.
              ``tmpdir`` should be None when device is 'gpu'. Defaults to None.
  
      Returns:
          list or None: The collected results.
      """
      if device not in ["gpu", "cpu"]:
          raise NotImplementedError(
              f"device must be 'cpu' or 'gpu', but got {device}"
          )
  
      if device == "gpu":
          assert (
              tmpdir is None
          ), 'tmpdir should be None when device is "gpu"'
          raise NotImplementedError(
              "GPU collecting has not been supported yet"
          )
      else:
          return collect_tracking_results_cpu(results, tmpdir)
  
file_path: mmdetection/mmdet/evaluation/metrics/base_video_metric.py
imports: import os.path
  import pickle
  import shutil
  import tempfile
  import warnings
  from typing import Optional, Sequence
  import torch
  from mmengine.dist import barrier, broadcast, broadcast_object_list, get_dist_info, is_main_process
  from mmengine.evaluator import BaseMetric
  from mmengine.utils import mkdir_or_exist
label_desc: Use image node_id 1 for calling a global function with example usage: collect_tracking_results(results, device, tmpdir) and returns: collect_tracking_results_cpu