Rois size problem of faster RCNN roi_pooling

I run faster rcnn code from https://github.com/pytorch/examples/tree/d8d378c31d2766009db400ac03f41dd837a56c2a/fast_rcnn

def roi_pooling(input, rois, size=(7,7), spatial_scale=1.0):
    assert(rois.dim() == 2)
    assert(rois.size(1) == 5)
    output = []
    rois = rois.data.float()
    num_rois = rois.size(0)
    
    rois[:,1:].mul_(spatial_scale)
    rois = rois.long()
    for i in range(num_rois):
        roi = rois[i]
        im_idx = roi[0]
        im = input.narrow(0, im_idx, 1)[..., roi[2]:(roi[4]+1), roi[1]:(roi[3]+1)]
        output.append(adaptive_max_pool(im, size))

    return torch.cat(output, 0)

the roi_pooling function here assert rois.size(1) == 5, however, rois generated from RPN have a size of ~2000*4, which means rois.size(1)=4. That is the coordinates.
the logic of RPN and roi_pooling are not self contained…
can someone help…
RPN: https://github.com/pytorch/examples/blob/d8d378c31d/fast_rcnn/rpn.py#L15
roi_pooling: https://github.com/pytorch/examples/blob/d8d378c31d/fast_rcnn/roi_pooling.py#L38