class_docstr: DyHead neck consisting of multiple DyHead Blocks.
  
  See `Dynamic Head: Unifying Object Detection Heads with Attentions
  <https://arxiv.org/abs/2106.08322>`_ for details.
  
  Args:
      in_channels (int): Number of input channels.
      out_channels (int): Number of output channels.
      num_blocks (int, optional): Number of DyHead Blocks. Default: 6.
      zero_init_offset (bool, optional): Whether to use zero init for
          `spatial_conv_offset`. Default: True.
      init_cfg (dict or list[dict], optional): Initialization config dict.
          Default: None.
class_docstr_tok: ["DyHead","neck","consisting","of","multiple","DyHead","Blocks",".","See","`","Dynamic","Head",":","Unifying","Object","Detection","Heads","with","Attentions","<","https",":","\/\/arxiv.org\/abs\/2106.08322",">","`","_","for","details",".","Args",":","in_channels","(","int",")",":","Number","of","input","channels",".","out_channels","(","int",")",":","Number","of","output","channels",".","num_blocks","(","int",",","optional",")",":","Number","of","DyHead","Blocks",".","Default",":","6.","zero_init_offset","(","bool",",","optional",")",":","Whether","to","use","zero","init","for","`","spatial_conv_offset","`",".","Default",":","True",".","init_cfg","(","dict","or","list","[","dict","]",",","optional",")",":","Initialization","config","dict",".","Default",":","None","."]
code: def __init__(
      self,
      in_channels,
      out_channels,
      num_blocks=6,
      zero_init_offset=True,
      init_cfg=None,
  ):
      assert init_cfg is None, (
          "To prevent abnormal initialization "
          "behavior, init_cfg is not allowed to be set"
      )
      super().__init__(init_cfg=init_cfg)
      self.in_channels = in_channels
      self.out_channels = out_channels
      self.num_blocks = num_blocks
      self.zero_init_offset = zero_init_offset
  
      dyhead_blocks = []
      for i in range(num_blocks):
          in_channels = (
              self.in_channels if i == 0 else self.out_channels
          )
          dyhead_blocks.append(
              DyHeadBlock(
                  in_channels,
                  self.out_channels,
                  zero_init_offset=zero_init_offset,
              )
          )
      self.dyhead_blocks = nn.Sequential(*dyhead_blocks)
  
file_path: mmdetection/mmdet/models/necks/dyhead.py
imports: import torch.nn
  import torch.nn.functional
  from mmcv.cnn import build_activation_layer, build_norm_layer
  from mmcv.ops.modulated_deform_conv import ModulatedDeformConv2d
  from mmengine.model import BaseModule, constant_init, normal_init
  from mmdet.registry import MODELS
  from ..layers import DyReLU
label_desc: Use image node_id 1 to create a new DyHead object from inherited base classes: BaseModule with example: obj = DyHead(in_channels, out_channels, num_blocks, zero_init_offset, init_cfg)