class_docstr: Dynamic ReLU (DyReLU) module.
  
  See `Dynamic ReLU <https://arxiv.org/abs/2003.10027>`_ for details.
  Current implementation is specialized for task-aware attention in DyHead.
  HSigmoid arguments in default act_cfg follow DyHead official code.
  https://github.com/microsoft/DynamicHead/blob/master/dyhead/dyrelu.py
  
  Args:
      channels (int): The input (and output) channels of DyReLU module.
      ratio (int): Squeeze ratio in Squeeze-and-Excitation-like module,
          the intermediate channel will be ``int(channels/ratio)``.
          Defaults to 4.
      conv_cfg (None or dict): Config dict for convolution layer.
          Defaults to None, which means using conv2d.
      act_cfg (dict or Sequence[dict]): Config dict for activation layer.
          If act_cfg is a dict, two activation layers will be configurated
          by this dict. If act_cfg is a sequence of dicts, the first
          activation layer will be configurated by the first dict and the
          second activation layer will be configurated by the second dict.
          Defaults to (dict(type='ReLU'), dict(type='HSigmoid', bias=3.0,
          divisor=6.0))
      init_cfg (dict or list[dict], optional): Initialization config dict.
          Defaults to None
class_docstr_tok: ["Dynamic","ReLU","(","DyReLU",")","module",".","See","`","Dynamic","ReLU","<","https",":","\/\/arxiv.org\/abs\/2003.10027",">","`","_","for","details",".","Current","implementation","is","specialized","for","task-aware","attention","in","DyHead",".","HSigmoid","arguments","in","default","act_cfg","follow","DyHead","official","code",".","https",":","\/\/github.com\/microsoft\/DynamicHead\/blob\/master\/dyhead\/dyrelu.py","Args",":","channels","(","int",")",":","The","input","(","and","output",")","channels","of","DyReLU","module",".","ratio","(","int",")",":","Squeeze","ratio","in","Squeeze-and-Excitation-like","module",",","the","intermediate","channel","will","be","``","int","(","channels\/ratio",")","``",".","Defaults","to","4.","conv_cfg","(","None","or","dict",")",":","Config","dict","for","convolution","layer",".","Defaults","to","None",",","which","means","using","conv2d",".","act_cfg","(","dict","or","Sequence","[","dict","]",")",":","Config","dict","for","activation","layer",".","If","act_cfg","is","a","dict",",","two","activation","layers","will","be","configurated","by","this","dict",".","If","act_cfg","is","a","sequence","of","dicts",",","the","first","activation","layer","will","be","configurated","by","the","first","dict","and","the","second","activation","layer","will","be","configurated","by","the","second","dict",".","Defaults","to","(","dict","(","type='ReLU","'",")",",","dict","(","type='HSigmoid","'",",","bias=3.0",",","divisor=6.0",")",")","init_cfg","(","dict","or","list","[","dict","]",",","optional",")",":","Initialization","config","dict",".","Defaults","to","None"]
code: def __init__(
      self,
      channels: int,
      ratio: int = 4,
      conv_cfg: OptConfigType = None,
      act_cfg: MultiConfig = (
          dict(type="ReLU"),
          dict(type="HSigmoid", bias=3.0, divisor=6.0),
      ),
      init_cfg: OptMultiConfig = None,
  ) -> None:
      super().__init__(init_cfg=init_cfg)
      if isinstance(act_cfg, dict):
          act_cfg = (act_cfg, act_cfg)
      assert len(act_cfg) == 2
      assert is_tuple_of(act_cfg, dict)
      self.channels = channels
      self.expansion = 4  # for a1, b1, a2, b2
      self.global_avgpool = nn.AdaptiveAvgPool2d(1)
      self.conv1 = ConvModule(
          in_channels=channels,
          out_channels=int(channels / ratio),
          kernel_size=1,
          stride=1,
          conv_cfg=conv_cfg,
          act_cfg=act_cfg[0],
      )
      self.conv2 = ConvModule(
          in_channels=int(channels / ratio),
          out_channels=channels * self.expansion,
          kernel_size=1,
          stride=1,
          conv_cfg=conv_cfg,
          act_cfg=act_cfg[1],
      )
  
file_path: mmdetection/mmdet/models/layers/se_layer.py
imports: import torch
  import torch.nn
  from mmcv.cnn import ConvModule
  from mmengine.model import BaseModule
  from mmengine.utils import digit_version, is_tuple_of
  from torch import Tensor
  from mmdet.utils import MultiConfig, OptConfigType, OptMultiConfig
label_desc: Use image node_id 1 to create a new DyReLU object from inherited base classes: BaseModule with example: obj = DyReLU(channels, ratio, conv_cfg, act_cfg, init_cfg)