def METHOD_NAME(self, x, rois):
    """Box head forward function used in both training and testing time."""
    bbox_cls_feats = self.bbox_roi_extractor(
        x[:self.bbox_roi_extractor.num_inputs], rois)
    bbox_reg_feats = self.bbox_roi_extractor(
        x[:self.bbox_roi_extractor.num_inputs],
        rois,
        roi_scale_factor=self.reg_roi_scale_factor)
    if self.with_shared_head:
        bbox_cls_feats = self.shared_head(bbox_cls_feats)
        bbox_reg_feats = self.shared_head(bbox_reg_feats)
    cls_score, bbox_pred = self.bbox_head(bbox_cls_feats, bbox_reg_feats)
    bbox_results = dict(
        cls_score=cls_score,
        bbox_pred=bbox_pred,
        bbox_feats=bbox_cls_feats)
    return bbox_results