class_docstr: CondInst mask head used in https://arxiv.org/abs/1904.02689.
  
  This head outputs the mask for CondInst.
  
  Args:
      mask_feature_head (dict): Config of CondInstMaskFeatHead.
      num_layers (int): Number of dynamic conv layers.
      feat_channels (int): Number of channels in the dynamic conv.
      mask_out_stride (int): The stride of the mask feat.
      size_of_interest (int): The size of the region used in rel coord.
      max_masks_to_train (int): Maximum number of masks to train for
          each image.
      loss_segm (:obj:`ConfigDict` or dict, optional): Config of
          segmentation loss.
      train_cfg (:obj:`ConfigDict` or dict, optional): Training config
          of head.
      test_cfg (:obj:`ConfigDict` or dict, optional): Testing config of
          head.
class_docstr_tok: ["CondInst","mask","head","used","in","https",":","\/\/arxiv.org\/abs\/1904.02689",".","This","head","outputs","the","mask","for","CondInst",".","Args",":","mask_feature_head","(","dict",")",":","Config","of","CondInstMaskFeatHead",".","num_layers","(","int",")",":","Number","of","dynamic","conv","layers",".","feat_channels","(","int",")",":","Number","of","channels","in","the","dynamic","conv",".","mask_out_stride","(","int",")",":","The","stride","of","the","mask","feat",".","size_of_interest","(","int",")",":","The","size","of","the","region","used","in","rel","coord",".","max_masks_to_train","(","int",")",":","Maximum","number","of","masks","to","train","for","each","image",".","loss_segm","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Config","of","segmentation","loss",".","train_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Training","config","of","head",".","test_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Testing","config","of","head","."]
docstr: Forward feature from the upstream network to get prototypes and
  linearly combine the prototypes, using masks coefficients, into
  instance masks. Finally, crop the instance masks with given bboxes.
  
  Args:
      x (Tuple[Tensor]): Feature from the upstream network, which is
          a 4D-tensor.
      positive_infos (List[:obj:``InstanceData``]): Positive information
          that calculate from detect head.
  
  Returns:
      tuple: Predicted instance segmentation masks
docstr_tok: ["Forward","feature","from","the","upstream","network","to","get","prototypes","and","linearly","combine","the","prototypes",",","using","masks","coefficients",",","into","instance","masks",".","Finally",",","crop","the","instance","masks","with","given","bboxes",".","Args",":","x","(","Tuple","[","Tensor","]",")",":","Feature","from","the","upstream","network",",","which","is","a","4D-tensor",".","positive_infos","(","List","[",":","obj",":","``","InstanceData","``","]",")",":","Positive","information","that","calculate","from","detect","head",".","Returns",":","tuple",":","Predicted","instance","segmentation","masks"]
code: def forward(self, x: tuple, positive_infos: InstanceList) -> tuple:
      """Forward feature from the upstream network to get prototypes and
      linearly combine the prototypes, using masks coefficients, into
      instance masks. Finally, crop the instance masks with given bboxes.
  
      Args:
          x (Tuple[Tensor]): Feature from the upstream network, which is
              a 4D-tensor.
          positive_infos (List[:obj:``InstanceData``]): Positive information
              that calculate from detect head.
  
      Returns:
          tuple: Predicted instance segmentation masks
      """
      mask_feats = self.mask_feature_head(x)
      return multi_apply(
          self.forward_single, mask_feats, positive_infos
      )
  
imports: import copy
  from typing import Dict, List, Optional, Tuple
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import ConvModule, Scale
  from mmengine.config import ConfigDict
  from mmengine.model import BaseModule, kaiming_init
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures.bbox import cat_boxes
  from mmdet.utils import ConfigType, InstanceList, MultiConfig, OptConfigType, OptInstanceList, reduce_mean
  from ..task_modules.prior_generators import MlvlPointGenerator
  from ..utils import aligned_bilinear, filter_scores_and_topk, multi_apply, relative_coordinate_maps, select_single_mlvl
  from ..utils.misc import empty_instances
  from .base_mask_head import BaseMaskHead
  from .fcos_head import FCOSHead
label_desc: Use image node_id 5 for calling the CondInstMaskHead obj's underlying member method code with example usage: obj.forward(x, positive_infos) and returns: multi_apply