class_docstr: SOLOv2 mask head used in `SOLOv2: Dynamic and Fast Instance
  Segmentation. <https://arxiv.org/pdf/2003.10152>`_
  
  Args:
      mask_feature_head (dict): Config of SOLOv2MaskFeatHead.
      dynamic_conv_size (int): Dynamic Conv kernel size. Defaults to 1.
      dcn_cfg (dict): Dcn conv configurations in kernel_convs and cls_conv.
          Defaults to None.
      dcn_apply_to_all_conv (bool): Whether to use dcn in every layer of
          kernel_convs and cls_convs, or only the last layer. It shall be set
          `True` for the normal version of SOLOv2 and `False` for the
          light-weight version. Defaults to True.
      init_cfg (dict or list[dict], optional): Initialization config dict.
class_docstr_tok: ["SOLOv2","mask","head","used","in","`","SOLOv2",":","Dynamic","and","Fast","Instance","Segmentation",".","<","https",":","\/\/arxiv.org\/pdf\/2003.10152",">","`","_","Args",":","mask_feature_head","(","dict",")",":","Config","of","SOLOv2MaskFeatHead",".","dynamic_conv_size","(","int",")",":","Dynamic","Conv","kernel","size",".","Defaults","to","1.","dcn_cfg","(","dict",")",":","Dcn","conv","configurations","in","kernel_convs","and","cls_conv",".","Defaults","to","None",".","dcn_apply_to_all_conv","(","bool",")",":","Whether","to","use","dcn","in","every","layer","of","kernel_convs","and","cls_convs",",","or","only","the","last","layer",".","It","shall","be","set","`","True","`","for","the","normal","version","of","SOLOv2","and","`","False","`","for","the","light-weight","version",".","Defaults","to","True",".","init_cfg","(","dict","or","list","[","dict","]",",","optional",")",":","Initialization","config","dict","."]
docstr: Initialize layers of the head.
docstr_tok: ["Initialize","layers","of","the","head","."]
code: def _init_layers(self) -> None:
      """Initialize layers of the head."""
      self.cls_convs = nn.ModuleList()
      self.kernel_convs = nn.ModuleList()
      conv_cfg = None
      for i in range(self.stacked_convs):
          if self.with_dcn:
              if self.dcn_apply_to_all_conv:
                  conv_cfg = self.dcn_cfg
              elif i == self.stacked_convs - 1:
                  # light head
                  conv_cfg = self.dcn_cfg
  
          chn = self.in_channels + 2 if i == 0 else self.feat_channels
          self.kernel_convs.append(
              ConvModule(
                  chn,
                  self.feat_channels,
                  3,
                  stride=1,
                  padding=1,
                  conv_cfg=conv_cfg,
                  norm_cfg=self.norm_cfg,
                  bias=self.norm_cfg is None,
              )
          )
  
          chn = self.in_channels if i == 0 else self.feat_channels
          self.cls_convs.append(
              ConvModule(
                  chn,
                  self.feat_channels,
                  3,
                  stride=1,
                  padding=1,
                  conv_cfg=conv_cfg,
                  norm_cfg=self.norm_cfg,
                  bias=self.norm_cfg is None,
              )
          )
  
      self.conv_cls = nn.Conv2d(
          self.feat_channels, self.cls_out_channels, 3, padding=1
      )
  
      self.conv_kernel = nn.Conv2d(
          self.feat_channels, self.kernel_out_channels, 3, padding=1
      )
  
imports: import warnings
  from typing import List, Optional, Tuple
  import mmcv
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import ConvModule
  from mmengine.model import BaseModule
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.models.utils.misc import floordiv
  from mmdet.registry import MODELS
  from mmdet.utils import ConfigType, InstanceList, MultiConfig, OptConfigType
  from ..layers import mask_matrix_nms
  from ..utils import center_of_mass, generate_coordinate, multi_apply
  from .solo_head import SOLOHead
label_desc: Use image node_id 2 for calling the SOLOV2Head obj's underlying member method code with example usage: obj._init_layers() without return types