code: def merge(
      img_ids: List[int], eval_imgs: List[np.ndarray]
  ) -> Tuple[np.ndarray, np.ndarray]:
      all_img_ids = all_gather(img_ids)
      all_eval_imgs = all_gather(eval_imgs)
  
      merged_img_ids = []
      for p in all_img_ids:
          merged_img_ids.extend(p)
  
      merged_eval_imgs = []
      for p in all_eval_imgs:
          merged_eval_imgs.append(p)
  
      merged_img_ids_np = np.array(merged_img_ids)
      merged_eval_imgs_np = np.concatenate(merged_eval_imgs, 2)
  
      # keep only unique (and in sorted order) images
      merged_img_ids_np, idx = np.unique(
          merged_img_ids_np, return_index=True
      )
      merged_eval_imgs_np = merged_eval_imgs_np[..., idx]
  
      return merged_img_ids_np, merged_eval_imgs_np
  
imports: import copy
  import io
  from collections import OrderedDict
  from contextlib import redirect_stdout
  from typing import Any, Dict, List, Optional, Tuple, Union
  import numpy
  import pycocotools.mask
  import torch
  import torch.distributed
  from pycocotools.coco import COCO
  from pycocotools.cocoeval import COCOeval
  from avalanche.evaluation.metrics.detection import DetectionEvaluator, TCommonDetectionOutput
label_desc: Use image node_id 5 for calling a global function with example usage: merge(img_ids, eval_imgs) and returns: merged_img_ids_np,  merged_eval_imgs_np