code: def __init__(
      self,
      dim: int,
      dropout: float,
      kernel_size: int = 3,
      stride: int = 1,
      *,
      ca_reduction: Optional[int] = None,
      eca_kernel_size: Optional[int] = None,
      norm_type: Optional[str] = "batch",
      **kwargs: Any,
  ):
      super().__init__()
      kwargs["norm_type"] = norm_type
      k1 = shallow_copy_dict(kwargs)
      k1["ca_reduction"] = ca_reduction
      k1.setdefault("activation", nn.LeakyReLU(0.2, inplace=True))
      blocks = get_conv_blocks(dim, dim, kernel_size, stride, **k1)
      if 0.0 < dropout < 1.0:
          blocks.append(nn.Dropout(dropout))
      k2 = shallow_copy_dict(kwargs)
      k2["activation"] = None
      k2["eca_kernel_size"] = eca_kernel_size
      blocks.extend(
          get_conv_blocks(dim, dim, kernel_size, stride, **k2)
      )
      self.net = Residual(nn.Sequential(*blocks))
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from torch import Tensor
  from typing import Any
  from typing import Optional
  from torch.nn import Module
  from cftool.misc import shallow_copy_dict
  from .basic import conv_nd
  from .basic import get_conv_blocks
  from ..utils import avg_pool_nd
  from ..utils import zero_module
  from ..utils import Residual
  from ..hijacks import HijackConv2d
  from ..hijacks import HijackLinear
  from ....misc.toolkit import safe_clip_
  from ....misc.toolkit import gradient_checkpoint
label_desc: Use image node_id 1 to create a new ResidualBlock object from inherited base classes: Module with example: obj = ResidualBlock(dim, dropout, kernel_size, stride)