class_docstr: FocalNet backbone
  Args:
      arch (str): Architecture of FocalNet
      out_indices (Sequence[int]): Output from which stages.
      frozen_stages (int): Stages to be frozen (stop grad and set eval mode).
          -1 means not freezing any parameters.
      patch_size (int | tuple(int)): Patch size. Default: 4.
      in_chans (int): Number of input image channels. Default: 3.
      embed_dim (int): Number of linear projection output channels. Default: 96.
      depths (tuple[int]): Depths of each FocalNet Transformer stage.
      mlp_ratio (float): Ratio of mlp hidden dim to embedding dim. Default: 4.
      drop_rate (float): Dropout rate.
      drop_path_rate (float): Stochastic depth rate. Default: 0.2.
      norm_layer (nn.Layer): Normalization layer. Default: nn.LayerNorm.
      patch_norm (bool): If True, add normalization after patch embedding. Default: True.
      focal_levels (Sequence[int]): Number of focal levels at four stages
      focal_windows (Sequence[int]): Focal window sizes at first focal level at four stages
      use_conv_embed (bool): Whether use overlapped convolution for patch embedding
      use_layerscale (bool): Whether use layerscale proposed in CaiT. Default: False 
      layerscale_value (float): Value of layerscale
      use_postln (bool): Whether use layernorm after modulation. Default: False.
      use_postln_in_modulation (bool): Whether use post-modulation layernorm. Default: False.
      normalize_modulator (bool): Whether use normalize in modulator
      use_checkpoint (bool): Whether to use checkpointing to save memory. Default: False.
class_docstr_tok: ["FocalNet","backbone","Args",":","arch","(","str",")",":","Architecture","of","FocalNet","out_indices","(","Sequence","[","int","]",")",":","Output","from","which","stages",".","frozen_stages","(","int",")",":","Stages","to","be","frozen","(","stop","grad","and","set","eval","mode",")",".","-1","means","not","freezing","any","parameters",".","patch_size","(","int","|","tuple","(","int",")",")",":","Patch","size",".","Default",":","4.","in_chans","(","int",")",":","Number","of","input","image","channels",".","Default",":","3.","embed_dim","(","int",")",":","Number","of","linear","projection","output","channels",".","Default",":","96.","depths","(","tuple","[","int","]",")",":","Depths","of","each","FocalNet","Transformer","stage",".","mlp_ratio","(","float",")",":","Ratio","of","mlp","hidden","dim","to","embedding","dim",".","Default",":","4.","drop_rate","(","float",")",":","Dropout","rate",".","drop_path_rate","(","float",")",":","Stochastic","depth","rate",".","Default",":","0.2.","norm_layer","(","nn.Layer",")",":","Normalization","layer",".","Default",":","nn.LayerNorm",".","patch_norm","(","bool",")",":","If","True",",","add","normalization","after","patch","embedding",".","Default",":","True",".","focal_levels","(","Sequence","[","int","]",")",":","Number","of","focal","levels","at","four","stages","focal_windows","(","Sequence","[","int","]",")",":","Focal","window","sizes","at","first","focal","level","at","four","stages","use_conv_embed","(","bool",")",":","Whether","use","overlapped","convolution","for","patch","embedding","use_layerscale","(","bool",")",":","Whether","use","layerscale","proposed","in","CaiT",".","Default",":","False","layerscale_value","(","float",")",":","Value","of","layerscale","use_postln","(","bool",")",":","Whether","use","layernorm","after","modulation",".","Default",":","False",".","use_postln_in_modulation","(","bool",")",":","Whether","use","post-modulation","layernorm",".","Default",":","False",".","normalize_modulator","(","bool",")",":","Whether","use","normalize","in","modulator","use_checkpoint","(","bool",")",":","Whether","to","use","checkpointing","to","save","memory",".","Default",":","False","."]
code: def forward(self, x):
      x = self.patch_embed(x["image"])
      B, _, Wh, Ww = x.shape
      x = x.flatten(2).transpose([0, 2, 1])
      x = self.pos_drop(x)
      outs = []
      for i in range(self.num_layers):
          layer = self.layers[i]
          x_out, H, W, x, Wh, Ww = layer(x, Wh, Ww)
          if i in self.out_indices:
              norm_layer = getattr(self, f"norm{i}")
              x_out = norm_layer(x_out)
              out = x_out.reshape(
                  [-1, H, W, self.num_features[i]]
              ).transpose((0, 3, 1, 2))
              outs.append(out)
  
      return outs
  
imports: import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from ppdet.modeling.shape_spec import ShapeSpec
  from ppdet.core.workspace import register, serializable
  from .transformer_utils import DropPath, Identity
  from .transformer_utils import add_parameter, to_2tuple
  from .transformer_utils import ones_, zeros_, trunc_normal_
  from .swin_transformer import Mlp
label_desc: Use image node_id 4 for calling the FocalNet obj's underlying member method code with example usage: obj.forward(x) and returns: outs