code: def clip_coords(boxes, shape):
      # Clip bounding xyxy bounding boxes to image shape (height, width)
      if isinstance(boxes, torch.Tensor):  # faster individually
          boxes[:, 0].clamp_(0, shape[1])  # x1
          boxes[:, 1].clamp_(0, shape[0])  # y1
          boxes[:, 2].clamp_(0, shape[1])  # x2
          boxes[:, 3].clamp_(0, shape[0])  # y2
      else:  # np.array (faster grouped)
          boxes[:, [0, 2]] = boxes[:, [0, 2]].clip(
              0, shape[1]
          )  # x1, x2
          boxes[:, [1, 3]] = boxes[:, [1, 3]].clip(0, shape[0])
  
imports: import os
  import time
  import json
  import copy
  import cv2
  import numpy
  import torch
  from torchmetrics.detection.mean_ap import MeanAveragePrecision
  import torchvision
  from pycocotools.coco import COCO
  from pycocotools.cocoeval import COCOeval
  from compression.api import DataLoader, Metric
label_desc: Use image node_id 6 for calling a global function with example usage: clip_coords(boxes, shape) without return types