class_docstr: RTMDetHead with separated BN layers and shared conv layers.
  
  Args:
      num_classes (int): Number of categories excluding the background
          category.
      in_channels (int): Number of channels in the input feature map.
      share_conv (bool): Whether to share conv layers between stages.
          Defaults to True.
      use_depthwise (bool): Whether to use depthwise separable convolution in
          head. Defaults to False.
      norm_cfg (:obj:`ConfigDict` or dict)): Config dict for normalization
          layer. Defaults to dict(type='BN', momentum=0.03, eps=0.001).
      act_cfg (:obj:`ConfigDict` or dict)): Config dict for activation layer.
          Defaults to dict(type='SiLU').
      pred_kernel_size (int): Kernel size of prediction layer. Defaults to 1.
class_docstr_tok: ["RTMDetHead","with","separated","BN","layers","and","shared","conv","layers",".","Args",":","num_classes","(","int",")",":","Number","of","categories","excluding","the","background","category",".","in_channels","(","int",")",":","Number","of","channels","in","the","input","feature","map",".","share_conv","(","bool",")",":","Whether","to","share","conv","layers","between","stages",".","Defaults","to","True",".","use_depthwise","(","bool",")",":","Whether","to","use","depthwise","separable","convolution","in","head",".","Defaults","to","False",".","norm_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",")",")",":","Config","dict","for","normalization","layer",".","Defaults","to","dict","(","type='BN","'",",","momentum=0.03",",","eps=0.001",")",".","act_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",")",")",":","Config","dict","for","activation","layer",".","Defaults","to","dict","(","type='SiLU","'",")",".","pred_kernel_size","(","int",")",":","Kernel","size","of","prediction","layer",".","Defaults","to","1","."]
docstr: Initialize layers of the head.
docstr_tok: ["Initialize","layers","of","the","head","."]
code: def _init_layers(self) -> None:
      """Initialize layers of the head."""
      conv = (
          DepthwiseSeparableConvModule
          if self.use_depthwise
          else ConvModule
      )
      self.cls_convs = nn.ModuleList()
      self.reg_convs = nn.ModuleList()
  
      self.rtm_cls = nn.ModuleList()
      self.rtm_reg = nn.ModuleList()
      if self.with_objectness:
          self.rtm_obj = nn.ModuleList()
      for n in range(len(self.prior_generator.strides)):
          cls_convs = nn.ModuleList()
          reg_convs = nn.ModuleList()
          for i in range(self.stacked_convs):
              chn = self.in_channels if i == 0 else self.feat_channels
              cls_convs.append(
                  conv(
                      chn,
                      self.feat_channels,
                      3,
                      stride=1,
                      padding=1,
                      conv_cfg=self.conv_cfg,
                      norm_cfg=self.norm_cfg,
                      act_cfg=self.act_cfg,
                  )
              )
              reg_convs.append(
                  conv(
                      chn,
                      self.feat_channels,
                      3,
                      stride=1,
                      padding=1,
                      conv_cfg=self.conv_cfg,
                      norm_cfg=self.norm_cfg,
                      act_cfg=self.act_cfg,
                  )
              )
          self.cls_convs.append(cls_convs)
          self.reg_convs.append(reg_convs)
  
          self.rtm_cls.append(
              nn.Conv2d(
                  self.feat_channels,
                  self.num_base_priors * self.cls_out_channels,
                  self.pred_kernel_size,
                  padding=self.pred_kernel_size // 2,
              )
          )
          self.rtm_reg.append(
              nn.Conv2d(
                  self.feat_channels,
                  self.num_base_priors * 4,
                  self.pred_kernel_size,
                  padding=self.pred_kernel_size // 2,
              )
          )
          if self.with_objectness:
              self.rtm_obj.append(
                  nn.Conv2d(
                      self.feat_channels,
                      1,
                      self.pred_kernel_size,
                      padding=self.pred_kernel_size // 2,
                  )
              )
  
      if self.share_conv:
          for n in range(len(self.prior_generator.strides)):
              for i in range(self.stacked_convs):
                  self.cls_convs[n][i].conv = self.cls_convs[0][i].conv
                  self.reg_convs[n][i].conv = self.reg_convs[0][i].conv
  
imports: from typing import List, Optional, Tuple, Union
  import torch
  import torch.nn
  from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule, Scale, is_norm
  from mmengine.model import bias_init_with_prob, constant_init, normal_init
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.registry import MODELS, TASK_UTILS
  from mmdet.structures.bbox import distance2bbox
  from mmdet.utils import ConfigType, InstanceList, OptInstanceList, reduce_mean
  from ..layers.transformer import inverse_sigmoid
  from ..task_modules import anchor_inside_flags
  from ..utils import images_to_levels, multi_apply, sigmoid_geometric_mean, unmap
  from .atss_head import ATSSHead
label_desc: Use image node_id 2 for calling the RTMDetSepBNHead obj's underlying member method code with example usage: obj._init_layers() without return types