def bbox_ioa(box1: "torch.Tensor", box2: "torch.Tensor", eps: float = 1e-7) -> "torch.Tensor":
    """
    === NOTE ===
    This function is copied from YOLOv5 repository (yolov5/utils/metrics.py)
    === ==== ===
    Calculate the intersection over two boxes represented by the format x1y1x2y2.

    :param box1: The first box.
    :param box2: The second box.

    :return: Intersection over box2 area
    """

    # Get the coordinates of bounding boxes
    b1_x1, b1_y1, b1_x2, b1_y2 = box1
    b2_x1, b2_y1, b2_x2, b2_y2 = box2.T

    # Intersection area
    inter_area = (np.minimum(b1_x2, b2_x2) - np.maximum(b1_x1, b2_x1)).clip(0) * (
        np.minimum(b1_y2, b2_y2) - np.maximum(b1_y1, b2_y1)
    ).clip(0)

    # box2 area
    box2_area = (b2_x2 - b2_x1) * (b2_y2 - b2_y1) + eps

    # Intersection over box2 area
    return inter_area / box2_area

    === NOTE ===
    This function is copied from YOLOv5 repository (yolov5/utils/metrics.py)
    === ==== ===
    Calculate the intersection over two boxes represented by the format x1y1x2y2.

    :param box1: The first box.
    :param box2: The second box.

    :return: Intersection over box2 area
    
art/attacks/evasion/steal_now_attack_later/bbox_ioa.py