code: def pairwise_iou(boxes1: Boxes, boxes2: Boxes) -> torch.Tensor:
      """
      Given two lists of boxes of size N and M,
      compute the IoU (intersection over union)
      between __all__ N x M pairs of boxes.
      The box order must be (xmin, ymin, xmax, ymax).
  
      Args:
          boxes1,boxes2 (Boxes): two `Boxes`. Contains N & M boxes, respectively.
  
      Returns:
          Tensor: IoU, sized [N,M].
      """
      area1 = boxes1.area()
      area2 = boxes2.area()
  
      boxes1, boxes2 = boxes1.tensor, boxes2.tensor
  
      width_height = torch.min(
          boxes1[:, None, 2:], boxes2[:, 2:]
      ) - torch.max(
          boxes1[:, None, :2], boxes2[:, :2]
      )  # [N,M,2]
  
      width_height.clamp_(min=0)  # [N,M,2]
      inter = width_height.prod(dim=2)  # [N,M]
      del width_height
  
      # handle empty boxes
      iou = torch.where(
          inter > 0,
          inter / (area1[:, None] + area2 - inter),
          torch.zeros(1, dtype=inter.dtype, device=inter.device),
      )
      return iou
  
imports: import math
  from enum import IntEnum, unique
  from typing import Any, List, Tuple, Union
  import numpy
  import torch
label_desc: Use image node_id 1 for calling a global function with example usage: pairwise_iou(boxes1, boxes2) and returns: iou