class_docstr: Hybrid task cascade roi head including one bbox head and one mask head.
  
  https://arxiv.org/abs/1901.07518
  
  Args:
      num_stages (int): Number of cascade stages.
      stage_loss_weights (list[float]): Loss weight for every stage.
      semantic_roi_extractor (:obj:`ConfigDict` or dict, optional):
          Config of semantic roi extractor. Defaults to None.
      Semantic_head (:obj:`ConfigDict` or dict, optional):
          Config of semantic head. Defaults to None.
      interleaved (bool): Whether to interleaves the box branch and mask
          branch. If True, the mask branch can take the refined bounding
          box predictions. Defaults to True.
      mask_info_flow (bool): Whether to turn on the mask information flow,
          which means that feeding the mask features of the preceding stage
          to the current stage. Defaults to True.
docstr: Network forward process. Usually includes backbone, neck and head
  forward without any post-processing.
  
  Args:
      x (List[Tensor]): Multi-level features that may have different
          resolutions.
      rpn_results_list (list[:obj:`InstanceData`]): List of region
          proposals.
      batch_data_samples (list[:obj:`DetDataSample`]): Each item contains
          the meta information of each image and corresponding
          annotations.
  
  Returns
      tuple: A tuple of features from ``bbox_head`` and ``mask_head``
      forward.
docstr_tok: ["Network","forward","process",".","Usually","includes","backbone",",","neck","and","head","forward","without","any","post-processing",".","Args",":","x","(","List","[","Tensor","]",")",":","Multi-level","features","that","may","have","different","resolutions",".","rpn_results_list","(","list","[",":","obj",":","`","InstanceData","`","]",")",":","List","of","region","proposals",".","batch_data_samples","(","list","[",":","obj",":","`","DetDataSample","`","]",")",":","Each","item","contains","the","meta","information","of","each","image","and","corresponding","annotations",".","Returns","tuple",":","A","tuple","of","features","from","``","bbox_head","``","and","``","mask_head","``","forward","."]
code: def forward(
      self,
      x: Tuple[Tensor],
      rpn_results_list: InstanceList,
      batch_data_samples: SampleList,
  ) -> tuple:
      """Network forward process. Usually includes backbone, neck and head
      forward without any post-processing.
  
      Args:
          x (List[Tensor]): Multi-level features that may have different
              resolutions.
          rpn_results_list (list[:obj:`InstanceData`]): List of region
              proposals.
          batch_data_samples (list[:obj:`DetDataSample`]): Each item contains
              the meta information of each image and corresponding
              annotations.
  
      Returns
          tuple: A tuple of features from ``bbox_head`` and ``mask_head``
          forward.
      """
      results = ()
      batch_img_metas = [
          data_samples.metainfo for data_samples in batch_data_samples
      ]
      num_imgs = len(batch_img_metas)
  
      if self.with_semantic:
          _, semantic_feat = self.semantic_head(x)
      else:
          semantic_feat = None
  
      proposals = [
          rpn_results.bboxes for rpn_results in rpn_results_list
      ]
      num_proposals_per_img = tuple(len(p) for p in proposals)
      rois = bbox2roi(proposals)
      # bbox head
      if self.with_bbox:
          rois, cls_scores, bbox_preds = self._refine_roi(
              x=x,
              rois=rois,
              semantic_feat=semantic_feat,
              batch_img_metas=batch_img_metas,
              num_proposals_per_img=num_proposals_per_img,
          )
          results = results + (cls_scores, bbox_preds)
      # mask head
      if self.with_mask:
          rois = torch.cat(rois)
          mask_results = self._mask_forward(
              stage=-1,
              x=x,
              rois=rois,
              semantic_feat=semantic_feat,
              training=False,
          )
          aug_masks = [
              [
                  mask.sigmoid().detach()
                  for mask in mask_preds.split(num_proposals_per_img, 0)
              ]
              for mask_preds in mask_results["mask_preds"]
          ]
  
          merged_masks = []
          for i in range(num_imgs):
              aug_mask = [mask[i] for mask in aug_masks]
              merged_mask = merge_aug_masks(
                  aug_mask, batch_img_metas[i]
              )
              merged_masks.append(merged_mask)
          results = results + (merged_masks,)
      return results
  
imports: from typing import Dict, List, Optional, Tuple
  import torch
  import torch.nn.functional
  from torch import Tensor
  from mmdet.models.test_time_augs import merge_aug_masks
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
  from mmdet.structures.bbox import bbox2roi
  from mmdet.utils import InstanceList, OptConfigType
  from ..layers import adaptive_avg_pool2d
  from ..task_modules.samplers import SamplingResult
  from ..utils import empty_instances, unpack_gt_instances
  from .cascade_roi_head import CascadeRoIHead
label_desc: Use image node_id 10 for calling the HybridTaskCascadeRoIHead obj's underlying member method code with example usage: obj.forward(x, rpn_results_list, batch_data_samples) and returns: results