'Slicing for ROIPooling along one dimension.
h: is the index on the pooled map (output index)
stride:
H: the max of the input map
roi_offset: how far hstart is from 0'

def _roipooling_slice(self, h, stride, H, roi_offset):

    hstart = int(np.floor((float(h) * stride)))
    hend = int(np.ceil((float((h + 1)) * stride)))
    hstart = min(max((hstart + roi_offset), 0), H)
    hend = min(max((hend + roi_offset), 0), H)
    return (slice(hstart, hend), (hend - hstart))
