def generate_anchors(ratios=(0.5, 1, 2), scales=(8, 16, 32)):
    """
    Generate anchor (reference) windows by enumerating aspect ratios X
    scales wrt a reference (0, 0, 15, 15) window.
    """
    anchors = []
    for size in scales:
        area = size**2.0
        for aspect_ratio in ratios:
            im_w = math.sqrt(area / aspect_ratio)
            im_h = aspect_ratio * im_w
            im_x0, im_y0, im_x1, im_y1 = (
                -im_w / 2.0,
                -im_h / 2.0,
                im_w / 2.0,
                im_h / 2.0,
            )
            anchors.append([im_x0, im_y0, im_x1, im_y1])
    return np.array(anchors)
Generate anchor (reference) windows by enumerating aspect ratios X
scales wrt a reference (0, 0, 15, 15) window.
python/aitemplate/frontend/nn/proposal.py