class_docstr: Focal Modulation Block.
  
  Args:
      dim (int): Number of input channels.
      mlp_ratio (float): Ratio of mlp hidden dim to embedding dim.
      drop (float, optional): Dropout rate. Default: 0.0
      drop_path (float, optional): Stochastic depth rate. Default: 0.0
      act_layer (nn.Module, optional): Activation layer. Default: nn.GELU
      norm_layer (nn.Module, optional): Normalization layer.
          Default: nn.LayerNorm
      focal_level (int): number of focal levels
      focal_window (int): focal kernel size at level 1
docstr: Forward function.
  
  Args:
      x: Input feature, tensor size (B, H*W, C).
      H, W: Spatial resolution of the input feature.
docstr_tok: ["Forward","function",".","Args",":","x",":","Input","feature",",","tensor","size","(","B",",","H","*","W",",","C",")",".","H",",","W",":","Spatial","resolution","of","the","input","feature","."]
code: def forward(self, x):
      """Forward function.
  
      Args:
          x: Input feature, tensor size (B, H*W, C).
          H, W: Spatial resolution of the input feature.
      """
      B, L, C = x.shape
      H, W = self.H, self.W
      assert L == H * W, "input feature has wrong size"
  
      x = x.view(B, H, W, C).permute(0, 3, 1, 2).contiguous()
      x = x + self.dw1(x)
      x = x.permute(0, 2, 3, 1).contiguous().view(B, L, C)
  
      shortcut = x
      if not self.use_postln:
          x = self.norm1(x)
      x = x.view(B, H, W, C)
  
      # FM
      x = self.modulation(x).view(B, H * W, C)
      x = shortcut + self.drop_path(self.gamma_1 * x)
      if self.use_postln:
          x = self.norm1(x)
  
      x = x.view(B, H, W, C).permute(0, 3, 1, 2).contiguous()
      x = x + self.dw2(x)
      x = x.permute(0, 2, 3, 1).contiguous().view(B, L, C)
  
      if not self.use_postln:
          x = x + self.drop_path(self.gamma_2 * self.mlp(self.norm2(x)))
      else:
          x = x + self.drop_path(self.gamma_2 * self.mlp(x))
          x = self.norm2(x)
  
      return x
  
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 2 for calling the FocalModulationBlock obj's underlying member method code with example usage: obj.forward(x) and returns: x