class_docstr: A basic focal modulation layer for one stage.
  
  Args:
      dim (int): Number of feature channels
      depth (int): Depths of this stage.
      mlp_ratio (float): Ratio of mlp hidden dim to embedding dim.
          Default: 4.
      drop (float, optional): Dropout rate. Default: 0.0
      drop_path (float | tuple[float], optional): Stochastic depth rate.
          Default: 0.0
      norm_layer (nn.Module, optional): Normalization layer.
          Default: nn.LayerNorm
      downsample (nn.Module | None, optional): Downsample layer at the
          end of the layer. Default: None
      focal_level (int): Number of focal levels
      focal_window (int): Focal window size at focal level 1
      use_conv_embed (bool): Use overlapped convolution for patch
          embedding or now. Default: False
      use_checkpoint (bool): Whether to use checkpointing to save memory.
          Default: False
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, H, W):
      """Forward function.
  
      Args:
          x: Input feature, tensor size (B, H*W, C).
          H, W: Spatial resolution of the input feature.
      """
      for blk in self.blocks:
          blk.H, blk.W = H, W
          if self.use_checkpoint:
              x = checkpoint.checkpoint(blk, x)
          else:
              x = blk(x)
      if self.downsample is not None:
          x_reshaped = x.transpose(1, 2).view(
              x.shape[0], x.shape[-1], H, W
          )
          x_down = self.downsample(x_reshaped)
          x_down = x_down.flatten(2).transpose(1, 2)
          Wh, Ww = (H + 1) // 2, (W + 1) // 2
          return x, H, W, x_down, Wh, Ww
      else:
          return x, H, W, x, H, W
  
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 BasicLayer obj's underlying member method code with example usage: obj.forward(x, H, W) and returns: x,  H,  W,  x_down,  Wh,  Ww, x,  H,  W,  x,  H,  W