code: def generalized_box_iou(
      boxes1: "torch.Tensor", boxes2: "torch.Tensor"
  ):
      """
      From DETR source: https://github.com/facebookresearch/detr
      (detr/util/box_ops.py)
      """
  
      assert (boxes1[:, 2:] >= boxes1[:, :2]).all()
      assert (boxes2[:, 2:] >= boxes2[:, :2]).all()
      iou, union = box_iou(boxes1, boxes2)
  
      l_t = torch.min(boxes1[:, None, :2], boxes2[:, :2])
      r_b = torch.max(boxes1[:, None, 2:], boxes2[:, 2:])
  
      w_h = (r_b - l_t).clamp(min=0)  # [N,M,2]
      area = w_h[:, :, 0] * w_h[:, :, 1]
  
      return iou - (area - union) / area
  
imports: from typing import List, Optional, Tuple, Union
  import torch
label_desc: Use image node_id 6 for calling a global function with example usage: generalized_box_iou(boxes1, boxes2) and returns: unknown