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","."]
code: def __init__(
      self,
      *args,
      mask_feature_head: ConfigType,
      dynamic_conv_size: int = 1,
      dcn_cfg: OptConfigType = None,
      dcn_apply_to_all_conv: bool = True,
      init_cfg: MultiConfig = [
          dict(type="Normal", layer="Conv2d", std=0.01),
          dict(
              type="Normal",
              std=0.01,
              bias_prob=0.01,
              override=dict(name="conv_cls"),
          ),
      ],
      **kwargs,
  ) -> None:
      assert dcn_cfg is None or isinstance(dcn_cfg, dict)
      self.dcn_cfg = dcn_cfg
      self.with_dcn = dcn_cfg is not None
      self.dcn_apply_to_all_conv = dcn_apply_to_all_conv
      self.dynamic_conv_size = dynamic_conv_size
      mask_out_channels = mask_feature_head.get("out_channels")
      self.kernel_out_channels = (
          mask_out_channels
          * self.dynamic_conv_size
          * self.dynamic_conv_size
      )
  
      super().__init__(*args, init_cfg=init_cfg, **kwargs)
  
      # update the in_channels of mask_feature_head
      if mask_feature_head.get("in_channels", None) is not None:
          if mask_feature_head.in_channels != self.in_channels:
              warnings.warn(
                  "The `in_channels` of SOLOv2MaskFeatHead and "
                  "SOLOv2Head should be same, changing "
                  "mask_feature_head.in_channels to "
                  f"{self.in_channels}"
              )
              mask_feature_head.update(in_channels=self.in_channels)
      else:
          mask_feature_head.update(in_channels=self.in_channels)
  
      self.mask_feature_head = MaskFeatModule(**mask_feature_head)
      self.mask_stride = self.mask_feature_head.mask_stride
      self.fp16_enabled = False
  
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 1 to create a new SOLOV2Head object from inherited base classes: SOLOHead with example: obj = SOLOV2Head()