(boxes1: Tensor, boxes2: Tensor, return_ioa=False)
return overlaps
Given two lists of boxes of size N and M,
    compute the IoU (intersection over union)
    between __all__ N x M pairs of boxes.
    The box order must be (xmin, ymin, xmax, ymax).

    Args:
        boxes1 (Tensor): boxes tensor with shape (N, 4)
        boxes2 (Tensor): boxes tensor with shape (M, 4)
        return_ioa (Bool): wheather return Intersection over Boxes1 or not, default: False

    Returns:
        iou (Tensor): IoU matrix, shape (N,M).
Given two lists of boxes of size N and M,
    compute the IoU (intersection over union)
    between __all__ N x M pairs of boxes.
    The box order must be (xmin, ymin, xmax, ymax).
Given two lists of boxes of size N and M compute the IoU ( intersection over union ) between __all__ N x M pairs of boxes . The box order must be ( xmin ymin xmax ymax ) .
def get_iou(boxes1: Tensor, boxes2: Tensor, return_ioa=False) -> Tensor:
    """
    Given two lists of boxes of size N and M,
    compute the IoU (intersection over union)
    between __all__ N x M pairs of boxes.
    The box order must be (xmin, ymin, xmax, ymax).

    Args:
        boxes1 (Tensor): boxes tensor with shape (N, 4)
        boxes2 (Tensor): boxes tensor with shape (M, 4)
        return_ioa (Bool): wheather return Intersection over Boxes1 or not, default: False

    Returns:
        iou (Tensor): IoU matrix, shape (N,M).
    """
    b_box1 = F.expand_dims(boxes1, axis=1)
    b_box2 = F.expand_dims(boxes2, axis=0)

    iw = F.minimum(b_box1[:, :, 2], b_box2[:, :, 2]) - F.maximum(
        b_box1[:, :, 0], b_box2[:, :, 0]
    )
    ih = F.minimum(b_box1[:, :, 3], b_box2[:, :, 3]) - F.maximum(
        b_box1[:, :, 1], b_box2[:, :, 1]
    )
    inter = F.maximum(iw, 0) * F.maximum(ih, 0)

    area_box1 = (boxes1[:, 2] - boxes1[:, 0]) * (boxes1[:, 3] - boxes1[:, 1])
    area_box2 = (boxes2[:, 2] - boxes2[:, 0]) * (boxes2[:, 3] - boxes2[:, 1])

    union = F.expand_dims(area_box1, axis=1) + F.expand_dims(area_box2, axis=0) - inter
    overlaps = F.maximum(inter / union, 0)

    if return_ioa:
        ioa = F.maximum(inter / area_box1, 0)
        return overlaps, ioa

    return overlaps
def get_iou ( boxes1 : Tensor , boxes2 : Tensor , return_ioa = False ) -> Tensor : b_box1 = F . expand_dims ( boxes1 , axis = 1 ) b_box2 = F . expand_dims ( boxes2 , axis = 0 ) iw = F . minimum ( b_box1 [ : , : , 2 ] , b_box2 [ : , : , 2 ] ) - F . maximum ( b_box1 [ : , : , 0 ] , b_box2 [ : , : , 0 ] ) ih = F . minimum ( b_box1 [ : , : , 3 ] , b_box2 [ : , : , 3 ] ) - F . maximum ( b_box1 [ : , : , 1 ] , b_box2 [ : , : , 1 ] ) inter = F . maximum ( iw , 0 ) * F . maximum ( ih , 0 ) area_box1 = ( boxes1 [ : , 2 ] - boxes1 [ : , 0 ] ) * ( boxes1 [ : , 3 ] - boxes1 [ : , 1 ] ) area_box2 = ( boxes2 [ : , 2 ] - boxes2 [ : , 0 ] ) * ( boxes2 [ : , 3 ] - boxes2 [ : , 1 ] ) union = F . expand_dims ( area_box1 , axis = 1 ) + F . expand_dims ( area_box2 , axis = 0 ) - inter overlaps = F . maximum ( inter / union , 0 ) if return_ioa : ioa = F . maximum ( inter / area_box1 , 0 ) return overlaps , ioa return overlaps