I used a third-party implementation from Github 8 for ROI pooling, since there doesn’t seem to be a native pytorch module in that regard. The module is instantiated as below
from roi_pooling.modules.roi_pool import RoIPool
...
self.roipool = RoIPool(6, 6, 1.0 / 16)