Rois size problem of faster RCNN roi_pooling

I run faster rcnn code from

def roi_pooling(input, rois, size=(7,7), spatial_scale=1.0):
    assert(rois.dim() == 2)
    assert(rois.size(1) == 5)
    output = []
    rois =
    num_rois = rois.size(0)
    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, 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…