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 features of a each image.
docstr_tok: ["Forward","features","of","a","each","image","."]
code: def forward_single(
      self, mask_feat: Tensor, positive_info: InstanceData
  ) -> Tensor:
      """Forward features of a each image."""
      pos_param_preds = positive_info.get("param_preds")
      pos_points = positive_info.get("points")
      pos_strides = positive_info.get("strides")
  
      num_inst = pos_param_preds.shape[0]
      mask_feat = mask_feat[None].repeat(num_inst, 1, 1, 1)
      _, _, H, W = mask_feat.size()
      if num_inst == 0:
          return (pos_param_preds.new_zeros((0, 1, H, W)),)
  
      locations = self.prior_generator.single_level_grid_priors(
          mask_feat.size()[2:], 0, device=mask_feat.device
      )
  
      rel_coords = relative_coordinate_maps(
          locations,
          pos_points,
          pos_strides,
          self.size_of_interest,
          mask_feat.size()[2:],
      )
      mask_head_inputs = torch.cat([rel_coords, mask_feat], dim=1)
      mask_head_inputs = mask_head_inputs.reshape(1, -1, H, W)
  
      weights, biases = self.parse_dynamic_params(pos_param_preds)
      mask_preds = self.dynamic_conv_forward(
          mask_head_inputs, weights, biases, num_inst
      )
      mask_preds = mask_preds.reshape(-1, H, W)
      mask_preds = aligned_bilinear(
          mask_preds.unsqueeze(0),
          int(self.mask_feat_stride / self.mask_out_stride),
      ).squeeze(0)
  
      return (mask_preds,)
  
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 6 for calling the CondInstMaskHead obj's underlying member method code with example usage: obj.forward_single(mask_feat, positive_info) and returns: mask_preds, pos_param_preds