def giou(boxlist1, boxlist2, scope=None):
  """Computes pairwise generalized IOU between two boxlists.

  Args:
    boxlist1: BoxList holding N boxes
    boxlist2: BoxList holding M boxes
    scope: name scope.

  Returns:
    a tensor with shape [N, M] representing the pairwise GIoU loss.
  """
  with tf.name_scope(scope, 'PairwiseGIoU'):
    n = boxlist1.num_boxes()
    m = boxlist2.num_boxes()
    boxes1 = tf.repeat(boxlist1.get(), repeats=m, axis=0)
    boxes2 = tf.tile(boxlist2.get(), multiples=[n, 1])
    return tf.reshape(ops.giou(boxes1, boxes2), [n, m])
Computes pairwise generalized IOU between two boxlists.

  Args:
    boxlist1: BoxList holding N boxes
    boxlist2: BoxList holding M boxes
    scope: name scope.

  Returns:
    a tensor with shape [N, M] representing the pairwise GIoU loss.
  
inference_api/src/main/object_detection/core/box_list_ops.py