code: def matched_pairwise_iou(
      boxes1: Boxes, boxes2: Boxes
  ) -> torch.Tensor:
      """
      Compute pairwise intersection over union (IOU) of two sets of matched
      boxes that have the same number of boxes.
      Similar to :func:`pairwise_iou`, but computes only diagonal elements of the matrix.
  
      Args:
          boxes1 (Boxes): bounding boxes, sized [N,4].
          boxes2 (Boxes): same length as boxes1
      Returns:
          Tensor: iou, sized [N].
      """
      assert len(boxes1) == len(boxes2), (
          "boxlists should have the same"
          "number of entries, got {}, {}".format(
              len(boxes1), len(boxes2)
          )
      )
      area1 = boxes1.area()  # [N]
      area2 = boxes2.area()  # [N]
      box1, box2 = boxes1.tensor, boxes2.tensor
      lt = torch.max(box1[:, :2], box2[:, :2])  # [N,2]
      rb = torch.min(box1[:, 2:], box2[:, 2:])  # [N,2]
      wh = (rb - lt).clamp(min=0)  # [N,2]
      inter = wh[:, 0] * wh[:, 1]  # [N]
      iou = inter / (area1 + area2 - inter)  # [N]
      return iou
  
imports: import math
  import numpy
  from enum import IntEnum, unique
  from typing import List, Tuple, Union
  import torch
  from torch import device
label_desc: Use image node_id 5 for calling a global function with example usage: matched_pairwise_iou(boxes1, boxes2) and returns: iou