class_docstr: Edge Residual Block.
  
  Args:
      in_channels (int): The input channels of this module.
      out_channels (int): The output channels of this module.
      mid_channels (int): The input channels of the second convolution.
      kernel_size (int): The kernel size of the first convolution.
          Defaults to 3.
      stride (int): The stride of the first convolution. Defaults to 1.
      se_cfg (dict, optional): Config dict for se layer. Defaults to None,
          which means no se layer.
      with_residual (bool): Use residual connection. Defaults to True.
      conv_cfg (dict, optional): Config dict for convolution layer.
          Defaults to None, which means using conv2d.
      norm_cfg (dict): Config dict for normalization layer.
          Defaults to ``dict(type='BN')``.
      act_cfg (dict): Config dict for activation layer.
          Defaults to ``dict(type='ReLU')``.
      drop_path_rate (float): stochastic depth rate. Defaults to 0.
      with_cp (bool): Use checkpoint or not. Using checkpoint will save some
          memory while slowing down the training speed. Defaults to False.
      init_cfg (dict | list[dict], optional): Initialization config dict.
code: def __init__(
      self,
      in_channels,
      out_channels,
      mid_channels,
      kernel_size=3,
      stride=1,
      se_cfg=None,
      with_residual=True,
      conv_cfg=None,
      norm_cfg=dict(type="BN"),
      act_cfg=dict(type="ReLU"),
      drop_path_rate=0.0,
      with_cp=False,
      init_cfg=None,
      **kwargs,
  ):
      super(EdgeResidual, self).__init__(init_cfg=init_cfg)
      assert stride in [1, 2]
      self.with_cp = with_cp
      self.drop_path = (
          DropPath(drop_path_rate)
          if drop_path_rate > 0
          else nn.Identity()
      )
      self.with_se = se_cfg is not None
      self.with_residual = (
          stride == 1 and in_channels == out_channels and with_residual
      )
  
      if self.with_se:
          assert isinstance(se_cfg, dict)
  
      self.conv1 = ConvModule(
          in_channels=in_channels,
          out_channels=mid_channels,
          kernel_size=kernel_size,
          stride=1,
          padding=kernel_size // 2,
          conv_cfg=conv_cfg,
          norm_cfg=norm_cfg,
          act_cfg=act_cfg,
      )
  
      if self.with_se:
          self.se = SELayer(**se_cfg)
  
      self.conv2 = ConvModule(
          in_channels=mid_channels,
          out_channels=out_channels,
          kernel_size=1,
          stride=stride,
          padding=0,
          conv_cfg=conv_cfg,
          norm_cfg=norm_cfg,
          act_cfg=None,
      )
  
imports: import copy
  import math
  from functools import partial
  import torch
  import torch.nn
  import torch.utils.checkpoint
  from mmcv.cnn.bricks import ConvModule, DropPath
  from mmengine.model import BaseModule, Sequential
  from mmdet.registry import MODELS
  from ..layers import InvertedResidual, SELayer
  from ..utils import make_divisible
label_desc: Use image node_id 1 to create a new EdgeResidual object from inherited base classes: BaseModule with example: obj = EdgeResidual(in_channels, out_channels, mid_channels, kernel_size, stride, se_cfg, with_residual, conv_cfg, norm_cfg, act_cfg, drop_path_rate, with_cp, init_cfg)