class_docstr: Simplest base roi head including one bbox head and one mask head.
class_docstr_tok: ["Simplest","base","roi","head","including","one","bbox","head","and","one","mask","head","."]
docstr: Mask head forward function used in both training and testing.
docstr_tok: ["Mask","head","forward","function","used","in","both","training","and","testing","."]
code: def _mask_forward(self, x, rois=None, pos_inds=None, bbox_feats=None):
      """Mask head forward function used in both training and testing."""
      assert (rois is not None) ^ (
          pos_inds is not None and bbox_feats is not None
      )
      if rois is not None:
          mask_feats = self.mask_roi_extractor(
              x[: self.mask_roi_extractor.num_inputs], rois
          )
          if self.with_shared_head:
              mask_feats = self.shared_head(mask_feats)
      else:
          assert bbox_feats is not None
          mask_feats = bbox_feats[pos_inds]
  
      mask_pred = self.mask_head(mask_feats)
      mask_results = dict(mask_pred=mask_pred, mask_feats=mask_feats)
      return mask_results
  
imports: import torch
  from mmdet.core import bbox2result, bbox2roi, build_assigner, build_sampler
  from ..builder import HEADS, build_head, build_roi_extractor
  from .base_roi_head import BaseRoIHead
  from .test_mixins import BBoxTestMixin, MaskTestMixin
label_desc: Use image node_id 10 for calling the StandardRoIHead obj's underlying member method code with example usage: obj._mask_forward(x, rois, pos_inds, bbox_feats) and returns: mask_results