code: def box_iou(
      box1: torch.Tensor, box2: torch.Tensor, eps: float = 1e-7
  ) -> torch.Tensor:
      # https://github.com/pytorch/vision/blob/master/torchvision/ops/boxes.py
      """
      Return intersection-over-union (Jaccard index) of boxes.
      Both sets of boxes are expected to be in (x1, y1, x2, y2) format.
      Arguments:
          box1 (Tensor[N, 4])
          box2 (Tensor[M, 4])
      Returns:
          iou (Tensor[N, M]): the NxM matrix containing the pairwise
              IoU values for every element in boxes1 and boxes2
      """
  
      # inter(N,M) = (rb(N,M,2) - lt(N,M,2)).clamp(0).prod(2)
      (a1, a2), (b1, b2) = box1.unsqueeze(1).chunk(
          2, 2
      ), box2.unsqueeze(0).chunk(2, 2)
      inter = (torch.min(a2, b2) - torch.max(a1, b1)).clamp(0).prod(2)
  
      # IoU = inter / (area1 + area2 - inter)
      return inter / (
          (a2 - a1).prod(2) + (b2 - b1).prod(2) - inter + eps
      )
  
imports: from __future__ import annotations
  import json
  import os
  import time
  import typing
  from pathlib import Path
  import attr
  import cv2
  import numpy
  import torch
  import torchvision
  from PIL import Image
label_desc: Use image node_id 11 for calling a global function with example usage: box_iou(box1, box2, eps) and returns: unknown