class_docstr: Implementation of `Grid RoI Head <https://arxiv.org/abs/1811.12030>`_
  
  Args:
      grid_roi_extractor (:obj:`ConfigDict` or dict): Config of
          roi extractor.
      grid_head (:obj:`ConfigDict` or dict): Config of grid head
class_docstr_tok: ["Implementation","of","`","Grid","RoI","Head","<","https",":","\/\/arxiv.org\/abs\/1811.12030",">","`","_","Args",":","grid_roi_extractor","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","roi","extractor",".","grid_head","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","grid","head"]
docstr: Network forward process. Usually includes backbone, neck and head
  forward without any post-processing.
  
  Args:
      x (Tuple[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","(","Tuple","[","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 = None,
  ) -> tuple:
      """Network forward process. Usually includes backbone, neck and head
      forward without any post-processing.
  
      Args:
          x (Tuple[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 = ()
      proposals = [
          rpn_results.bboxes for rpn_results in rpn_results_list
      ]
      rois = bbox2roi(proposals)
      # bbox head
      if self.with_bbox:
          bbox_results = self._bbox_forward(x, rois)
          results = results + (bbox_results["cls_score"],)
          if self.bbox_head.with_reg:
              results = results + (bbox_results["bbox_pred"],)
  
          # grid head
          grid_rois = rois[:100]
          grid_feats = self.grid_roi_extractor(
              x[: len(self.grid_roi_extractor.featmap_strides)],
              grid_rois,
          )
          if self.with_shared_head:
              grid_feats = self.shared_head(grid_feats)
          self.grid_head.test_mode = True
          grid_preds = self.grid_head(grid_feats)
          results = results + (grid_preds,)
  
      # mask head
      if self.with_mask:
          mask_rois = rois[:100]
          mask_results = self._mask_forward(x, mask_rois)
          results = results + (mask_results["mask_preds"],)
      return results
  
file_path: mmdetection/mmdet/models/roi_heads/grid_roi_head.py
imports: from typing import List, Optional, Tuple
  import torch
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
  from mmdet.structures.bbox import bbox2roi
  from mmdet.utils import ConfigType, InstanceList
  from ..task_modules.samplers import SamplingResult
  from ..utils.misc import unpack_gt_instances
  from .standard_roi_head import StandardRoIHead
label_desc: Use image node_id 3 for calling the GridRoIHead obj's underlying member method code with example usage: obj.forward(x, rpn_results_list, batch_data_samples) and returns: results