class_docstr: Focal Modulation.
  
  Args:
      dim (int): Number of input channels.
      proj_drop (float, optional): Dropout ratio of output. Default: 0.0
      focal_level (int): Number of focal levels
      focal_window (int): Focal window size at focal level 1
      focal_factor (int, default=2): Step to increase the focal window
code: def __init__(
      self,
      dim,
      proj_drop=0.0,
      focal_level=2,
      focal_window=7,
      focal_factor=2,
      use_postln_in_modulation=False,
      scaling_modulator=False,
  ):
      super().__init__()
      self.dim = dim
  
      self.focal_level = focal_level
      self.focal_window = focal_window
      self.focal_factor = focal_factor
      self.use_postln_in_modulation = use_postln_in_modulation
      self.scaling_modulator = scaling_modulator
  
      self.f = nn.Linear(
          dim, 2 * dim + (self.focal_level + 1), bias=True
      )
      self.h = nn.Conv2d(
          dim,
          dim,
          kernel_size=1,
          stride=1,
          padding=0,
          groups=1,
          bias=True,
      )
  
      self.act = nn.GELU()
      self.proj = nn.Linear(dim, dim)
      self.proj_drop = nn.Dropout(proj_drop)
      self.focal_layers = nn.ModuleList()
  
      if self.use_postln_in_modulation:
          self.ln = nn.LayerNorm(dim)
  
      for k in range(self.focal_level):
          kernel_size = self.focal_factor * k + self.focal_window
          self.focal_layers.append(
              nn.Sequential(
                  nn.Conv2d(
                      dim,
                      dim,
                      kernel_size=kernel_size,
                      stride=1,
                      groups=dim,
                      padding=kernel_size // 2,
                      bias=False,
                  ),
                  nn.GELU(),
              )
          )
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  import torch.utils.checkpoint
  from mmcv.cnn.bricks import DropPath
  from mmdet.registry import MODELS
label_desc: Use image node_id 1 to create a new FocalModulation object from inherited base classes: nn with example: obj = FocalModulation(dim, proj_drop, focal_level, focal_window, focal_factor, use_postln_in_modulation, scaling_modulator)