class_docstr: Swin Transformer backbone
  Args:
      arch (str): Architecture of FocalNet
      pretrain_img_size (int | tuple(int)): Input image size. Default 224
      patch_size (int | tuple(int)): Patch size. Default: 4
      in_chans (int): Number of input image channels. Default: 3
      embed_dim (int): Patch embedding dimension. Default: 96
      depths (tuple(int)): Depth of each Swin Transformer layer.
      num_heads (tuple(int)): Number of attention heads in different layers.
      window_size (int): Window size. Default: 7
      mlp_ratio (float): Ratio of mlp hidden dim to embedding dim. Default: 4
      qkv_bias (bool): If True, add a learnable bias to query, key, value. Default: True
      qk_scale (float): Override default qk scale of head_dim ** -0.5 if set. Default: None
      drop_rate (float): Dropout rate. Default: 0
      attn_drop_rate (float): Attention dropout rate. Default: 0
      drop_path_rate (float): Stochastic depth rate. Default: 0.1
      norm_layer (nn.Layer): Normalization layer. Default: nn.LayerNorm.
      ape (bool): If True, add absolute position embedding to the patch embedding. Default: False
      patch_norm (bool): If True, add normalization after patch embedding. Default: True
docstr: Forward function.
docstr_tok: ["Forward","function","."]
code: def forward(self, x):
      """Forward function."""
      x = self.patch_embed(x["image"])
      B, _, Wh, Ww = x.shape
      if self.ape:
          # interpolate the position embedding to the corresponding size
          absolute_pos_embed = F.interpolate(
              self.absolute_pos_embed, size=(Wh, Ww), mode="bicubic"
          )
          x = (x + absolute_pos_embed).flatten(2).transpose([0, 2, 1])
      else:
          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_
label_desc: Use image node_id 4 for calling the SwinTransformer obj's underlying member method code with example usage: obj.forward(x) and returns: outs