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
code: def _freeze_stages(self):
      if self.frozen_stages >= 0:
          self.patch_embed.eval()
          for param in self.patch_embed.parameters():
              param.stop_gradient = True
  
      if self.frozen_stages >= 1 and self.ape:
          self.absolute_pos_embed.stop_gradient = True
  
      if self.frozen_stages >= 2:
          self.pos_drop.eval()
          for i in range(0, self.frozen_stages - 1):
              m = self.layers[i]
              m.eval()
              for param in m.parameters():
                  param.stop_gradient = True
  
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 2 for calling the SwinTransformer obj's underlying member method code with example usage: obj._freeze_stages() without return types