I am trying to remove the 4th maxpooling layer in VGG16 using
    list1 = list(vgg.classifier._modules.values())[:23]
    list1.extend(list(vgg.classifier._modules.values())[24:-1])

    list2 = list(vgg.features._modules.values())[:23]
    list2.extend(list(vgg.features._modules.values())[24:-1])
    vgg.classifier = nn.Sequential(*list1)
    self.RCNN_base = nn.Sequential(*list2)

I have also changed
self.RCNN_roi_pool = _RoIPooling(cfg.POOLING_SIZE, cfg.POOLING_SIZE, 1.0/8.0)

from
self.RCNN_roi_pool = _RoIPooling(cfg.POOLING_SIZE, cfg.POOLING_SIZE, 1.0/16.0)

However I am getting size mismatch error
RuntimeError: size mismatch, m1: [256 x 1000], m2: [4096 x 8] at /opt/conda/conda-bld/pytorch_1524577177097/work/aten/src/THC/generic/THCTensorMathBlas.cu:249

Can you please help me with this?