def generate_fpn_anchors(im_h, im_w, feat_strides, scales, ratios, batch_size, dtype):
    """Enumerate anchors for all levels"""
    anchors = []
    for feat_stride, scale in zip(feat_strides, scales):
        anchors.append(
            generate_shifted_anchors(
                im_h,
                im_w,
                feat_stride,
                np.array(scale, dtype="float32"),
                np.array(ratios, dtype="float32"),
                batch_size,
                dtype,
            )
        )
    return anchors
Enumerate anchors for all levels
python/aitemplate/frontend/nn/fpn_proposal.py