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: Initialize layers of the head.
docstr_tok: ["Initialize","layers","of","the","head","."]
code: def _init_layers(self) -> None:
      """Initialize layers of the head."""
      weight_nums, bias_nums = [], []
      for i in range(self.num_layers):
          if i == 0:
              weight_nums.append(
                  (self.in_channels + 2) * self.feat_channels
              )
              bias_nums.append(self.feat_channels)
          elif i == self.num_layers - 1:
              weight_nums.append(self.feat_channels * 1)
              bias_nums.append(1)
          else:
              weight_nums.append(
                  self.feat_channels * self.feat_channels
              )
              bias_nums.append(self.feat_channels)
  
      self.weight_nums = weight_nums
      self.bias_nums = bias_nums
      self.num_params = sum(weight_nums) + sum(bias_nums)
  
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 2 for calling the CondInstMaskHead obj's underlying member method code with example usage: obj._init_layers() without return types