class_docstr: Cascade roi head including one bbox head and one mask head.
  
  https://arxiv.org/abs/1712.00726
docstr: Run forward function and calculate loss for mask head in
  training.
docstr_tok: ["Run","forward","function","and","calculate","loss","for","mask","head","in","training","."]
code: def _mask_forward_train(
      self,
      stage,
      x,
      sampling_results,
      gt_masks,
      rcnn_train_cfg,
      bbox_feats=None,
  ):
      """Run forward function and calculate loss for mask head in
      training."""
      pos_rois = bbox2roi([res.pos_bboxes for res in sampling_results])
      mask_results = self._mask_forward(stage, x, pos_rois)
  
      mask_targets = self.mask_head[stage].get_targets(
          sampling_results, gt_masks, rcnn_train_cfg
      )
      pos_labels = torch.cat(
          [res.pos_gt_labels for res in sampling_results]
      )
      loss_mask = self.mask_head[stage].loss(
          mask_results["mask_pred"], mask_targets, pos_labels
      )
  
      mask_results.update(loss_mask=loss_mask)
      return mask_results
  
imports: import torch
  import torch.nn
  from mmdet.core import bbox2result, bbox2roi, bbox_mapping, build_assigner, build_sampler, merge_aug_bboxes, merge_aug_masks, multiclass_nms
  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 CascadeRoIHead obj's underlying member method code with example usage: obj._mask_forward_train(stage, x, sampling_results, gt_masks, rcnn_train_cfg, bbox_feats) and returns: mask_results