code: def generalized_box_iou(boxes1, boxes2):
      """
      Generalized IoU from https://giou.stanford.edu/
      The boxes should be in [x0, y0, x1, y1] format
      Returns a [N, M] pairwise matrix, where N = len(boxes1)
      and M = len(boxes2)
      """
      # degenerate boxes gives inf / nan results
      # so do an early check
      assert (boxes1[:, 2:] >= boxes1[:, :2]).all()
      assert (boxes2[:, 2:] >= boxes2[:, :2]).all()
      iou, union = box_iou(boxes1, boxes2)
  
      lt = torch.min(boxes1[:, None, :2], boxes2[:, :2])
      rb = torch.max(boxes1[:, None, 2:], boxes2[:, 2:])
  
      wh = (rb - lt).clamp(min=0)  # [N,M,2]
      area = wh[:, :, 0] * wh[:, :, 1]
  
      return iou - (area - union) / area
  
imports: from collections import OrderedDict
  import torch
  from torch import nn
  from torch.jit.annotations import Dict
  from torch.nn import functional
label_desc: Use image node_id 9 for calling a global function with example usage: generalized_box_iou(boxes1, boxes2) and returns: unknown