code: def generalized_box_iou(boxes1: Tensor, boxes2: Tensor) -> Tensor:
      """
      Return generalized intersection-over-union (Jaccard index) between two sets of boxes.
  
      Both sets of boxes are expected to be in ``(x1, y1, x2, y2)`` format with
      ``0 <= x1 < x2`` and ``0 <= y1 < y2``.
  
      Args:
          boxes1 (Tensor[N, 4]): first set of boxes
          boxes2 (Tensor[M, 4]): second set of boxes
  
      Returns:
          Tensor[N, M]: the NxM matrix containing the pairwise generalized IoU values
          for every element in boxes1 and boxes2
      """
      if not torch.jit.is_scripting() and not torch.jit.is_tracing():
          _log_api_usage_once(generalized_box_iou)
  
      inter, union = _box_inter_union(boxes1, boxes2)
      iou = inter / union
  
      lti = torch.min(boxes1[:, None, :2], boxes2[:, :2])
      rbi = torch.max(boxes1[:, None, 2:], boxes2[:, 2:])
  
      whi = _upcast(rbi - lti).clamp(min=0)  # [N,M,2]
      areai = whi[:, :, 0] * whi[:, :, 1]
  
      return iou - (areai - union) / areai
  
imports: from typing import Tuple
  import torch
  import torchvision
  from torch import Tensor
  from torchvision.extension import _assert_has_ops
  from ..utils import _log_api_usage_once
  from ._box_convert import _box_cxcywh_to_xyxy, _box_xywh_to_xyxy, _box_xyxy_to_cxcywh, _box_xyxy_to_xywh
  from ._utils import _upcast
label_desc: Use image node_id 11 for calling a global function with example usage: generalized_box_iou(boxes1, boxes2) and returns: unknown