class_docstr: Hybrid task cascade roi head including one bbox head and one mask head.
  
  https://arxiv.org/abs/1901.07518
class_docstr_tok: ["Hybrid","task","cascade","roi","head","including","one","bbox","head","and","one","mask","head",".","https",":","\/\/arxiv.org\/abs\/1901.07518"]
docstr: Mask head forward function for testing.
docstr_tok: ["Mask","head","forward","function","for","testing","."]
code: def _mask_forward_test(self, stage, x, bboxes, semantic_feat=None):
      """Mask head forward function for testing."""
      mask_roi_extractor = self.mask_roi_extractor[stage]
      mask_head = self.mask_head[stage]
      mask_rois = bbox2roi([bboxes])
      mask_feats = mask_roi_extractor(
          x[: len(mask_roi_extractor.featmap_strides)], mask_rois
      )
      if self.with_semantic and "mask" in self.semantic_fusion:
          mask_semantic_feat = self.semantic_roi_extractor(
              [semantic_feat], mask_rois
          )
          if mask_semantic_feat.shape[-2:] != mask_feats.shape[-2:]:
              mask_semantic_feat = F.adaptive_avg_pool2d(
                  mask_semantic_feat, mask_feats.shape[-2:]
              )
          mask_feats += mask_semantic_feat
      if self.mask_info_flow:
          last_feat = None
          last_pred = None
          for i in range(stage):
              mask_pred, last_feat = self.mask_head[i](
                  mask_feats, last_feat
              )
              if last_pred is not None:
                  mask_pred = mask_pred + last_pred
              last_pred = mask_pred
          mask_pred = mask_head(
              mask_feats, last_feat, return_feat=False
          )
          if last_pred is not None:
              mask_pred = mask_pred + last_pred
      else:
          mask_pred = mask_head(mask_feats)
      return mask_pred
  
file_path: insightface/detection/scrfd/mmdet/models/roi_heads/htc_roi_head.py
imports: import torch
  import torch.nn.functional
  from mmdet.core import bbox2result, bbox2roi, bbox_mapping, merge_aug_bboxes, merge_aug_masks, multiclass_nms
  from ..builder import HEADS, build_head, build_roi_extractor
  from .cascade_roi_head import CascadeRoIHead
label_desc: Use image node_id 8 for calling the HybridTaskCascadeRoIHead obj's underlying member method code with example usage: obj._mask_forward_test(stage, x, bboxes, semantic_feat) and returns: mask_pred