class_docstr: Head of CentripetalNet: Pursuing High-quality Keypoint Pairs for Object
  Detection.
  
  CentripetalHead inherits from :class:`CornerHead`. It removes the
  embedding branch and adds guiding shift and centripetal shift branches.
  More details can be found in the `paper
  <https://arxiv.org/abs/2003.09119>`_ .
  
  Args:
      num_classes (int): Number of categories excluding the background
          category.
      in_channels (int): Number of channels in the input feature map.
      num_feat_levels (int): Levels of feature from the previous module.
          2 for HourglassNet-104 and 1 for HourglassNet-52. HourglassNet-104
          outputs the final feature and intermediate supervision feature and
          HourglassNet-52 only outputs the final feature. Defaults to 2.
      corner_emb_channels (int): Channel of embedding vector. Defaults to 1.
      train_cfg (:obj:`ConfigDict` or dict, optional): Training config.
          Useless in CornerHead, but we keep this variable for
          SingleStageDetector.
      test_cfg (:obj:`ConfigDict` or dict, optional): Testing config of
          CornerHead.
      loss_heatmap (:obj:`ConfigDict` or dict): Config of corner heatmap
          loss. Defaults to GaussianFocalLoss.
      loss_embedding (:obj:`ConfigDict` or dict): Config of corner embedding
          loss. Defaults to AssociativeEmbeddingLoss.
      loss_offset (:obj:`ConfigDict` or dict): Config of corner offset loss.
          Defaults to SmoothL1Loss.
      loss_guiding_shift (:obj:`ConfigDict` or dict): Config of
          guiding shift loss. Defaults to SmoothL1Loss.
      loss_centripetal_shift (:obj:`ConfigDict` or dict): Config of
          centripetal shift loss. Defaults to SmoothL1Loss.
     init_cfg (:obj:`ConfigDict` or dict, optional): the config to control
         the initialization.
class_docstr_tok: ["Head","of","CentripetalNet",":","Pursuing","High-quality","Keypoint","Pairs","for","Object","Detection",".","CentripetalHead","inherits","from",":","class",":","`","CornerHead","`",".","It","removes","the","embedding","branch","and","adds","guiding","shift","and","centripetal","shift","branches",".","More","details","can","be","found","in","the","`","paper","<","https",":","\/\/arxiv.org\/abs\/2003.09119",">","`","_",".","Args",":","num_classes","(","int",")",":","Number","of","categories","excluding","the","background","category",".","in_channels","(","int",")",":","Number","of","channels","in","the","input","feature","map",".","num_feat_levels","(","int",")",":","Levels","of","feature","from","the","previous","module",".","2","for","HourglassNet-104","and","1","for","HourglassNet-52",".","HourglassNet-104","outputs","the","final","feature","and","intermediate","supervision","feature","and","HourglassNet-52","only","outputs","the","final","feature",".","Defaults","to","2.","corner_emb_channels","(","int",")",":","Channel","of","embedding","vector",".","Defaults","to","1.","train_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Training","config",".","Useless","in","CornerHead",",","but","we","keep","this","variable","for","SingleStageDetector",".","test_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Testing","config","of","CornerHead",".","loss_heatmap","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","corner","heatmap","loss",".","Defaults","to","GaussianFocalLoss",".","loss_embedding","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","corner","embedding","loss",".","Defaults","to","AssociativeEmbeddingLoss",".","loss_offset","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","corner","offset","loss",".","Defaults","to","SmoothL1Loss",".","loss_guiding_shift","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","guiding","shift","loss",".","Defaults","to","SmoothL1Loss",".","loss_centripetal_shift","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","centripetal","shift","loss",".","Defaults","to","SmoothL1Loss",".","init_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","the","config","to","control","the","initialization","."]
docstr: Initialize centripetal layers.
  
  Including feature adaption deform convs (feat_adaption), deform offset
  prediction convs (dcn_off), guiding shift (guiding_shift) and
  centripetal shift ( centripetal_shift). Each branch has two parts:
  prefix `tl_` for top-left and `br_` for bottom-right.
docstr_tok: ["Initialize","centripetal","layers",".","Including","feature","adaption","deform","convs","(","feat_adaption",")",",","deform","offset","prediction","convs","(","dcn_off",")",",","guiding","shift","(","guiding_shift",")","and","centripetal","shift","(","centripetal_shift",")",".","Each","branch","has","two","parts",":","prefix","`","tl_","`","for","top-left","and","`","br_","`","for","bottom-right","."]
code: def _init_centripetal_layers(self) -> None:
      """Initialize centripetal layers.
  
      Including feature adaption deform convs (feat_adaption), deform offset
      prediction convs (dcn_off), guiding shift (guiding_shift) and
      centripetal shift ( centripetal_shift). Each branch has two parts:
      prefix `tl_` for top-left and `br_` for bottom-right.
      """
      self.tl_feat_adaption = nn.ModuleList()
      self.br_feat_adaption = nn.ModuleList()
      self.tl_dcn_offset = nn.ModuleList()
      self.br_dcn_offset = nn.ModuleList()
      self.tl_guiding_shift = nn.ModuleList()
      self.br_guiding_shift = nn.ModuleList()
      self.tl_centripetal_shift = nn.ModuleList()
      self.br_centripetal_shift = nn.ModuleList()
  
      for _ in range(self.num_feat_levels):
          self.tl_feat_adaption.append(
              DeformConv2d(
                  self.in_channels,
                  self.in_channels,
                  self.feat_adaption_conv_kernel,
                  1,
                  1,
              )
          )
          self.br_feat_adaption.append(
              DeformConv2d(
                  self.in_channels,
                  self.in_channels,
                  self.feat_adaption_conv_kernel,
                  1,
                  1,
              )
          )
  
          self.tl_guiding_shift.append(
              self._make_layers(
                  out_channels=self.guiding_shift_channels,
                  in_channels=self.in_channels,
              )
          )
          self.br_guiding_shift.append(
              self._make_layers(
                  out_channels=self.guiding_shift_channels,
                  in_channels=self.in_channels,
              )
          )
  
          self.tl_dcn_offset.append(
              ConvModule(
                  self.guiding_shift_channels,
                  self.feat_adaption_conv_kernel**2
                  * self.guiding_shift_channels,
                  1,
                  bias=False,
                  act_cfg=None,
              )
          )
          self.br_dcn_offset.append(
              ConvModule(
                  self.guiding_shift_channels,
                  self.feat_adaption_conv_kernel**2
                  * self.guiding_shift_channels,
                  1,
                  bias=False,
                  act_cfg=None,
              )
          )
  
          self.tl_centripetal_shift.append(
              self._make_layers(
                  out_channels=self.centripetal_shift_channels,
                  in_channels=self.in_channels,
              )
          )
          self.br_centripetal_shift.append(
              self._make_layers(
                  out_channels=self.centripetal_shift_channels,
                  in_channels=self.in_channels,
              )
          )
  
imports: from typing import List, Optional, Tuple
  import torch.nn
  from mmcv.cnn import ConvModule
  from mmcv.ops import DeformConv2d
  from mmengine.model import normal_init
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.utils import ConfigType, InstanceList, OptInstanceList, OptMultiConfig
  from ..utils import multi_apply
  from .corner_head import CornerHead
label_desc: Use image node_id 2 for calling the CentripetalHead obj's underlying member method code with example usage: obj._init_centripetal_layers() without return types