class_docstr: Swin Transformer
      A PaddlePaddle implementation of : `Swin Transformer: Hierarchical Vision Transformer using Shifted Windows`  -
        https://arxiv.org/pdf/2103.14030
  
  Args:
      img_size (int | tuple[int], optional): Input image size. Default 224
      patch_size (int | tuple[int], optional): Patch size. Default: 4
      in_chans (int, optional): Number of input image channels. Default: 3
      num_classes (int, optional): Number of classes for classification head. Default: 1000
      embed_dim (int, optional): Patch embedding dimension. Default: 96
      depths (tuple[int], optional): Depth of each Swin Transformer layer.
      num_heads (tuple[int], optional): Number of attention heads in different layers.
      window_size (int, optional): Window size. Default: 7
      mlp_ratio (float, optional): Ratio of mlp hidden dim to embedding dim. Default: 4
      qkv_bias (bool, optional): If True, add a learnable bias to query, key, value. Default: True
      qk_scale (float, optional): Override default query and key scale of head_dim ** -0.5 if set. Default: None
      drop_rate (float, optional): Dropout rate. Default: 0
      attn_drop_rate (float, optional): Attention dropout rate. Default: 0
      drop_path_rate (float, optional): Stochastic depth rate. Default: 0.1
      norm_layer (nn.Layer, optional): Normalization layer. Default: nn.LayerNorm.
      ape (bool, optional): If True, add absolute position embedding to the patch embedding. Default: False
      patch_norm (bool, optional): If True, add normalization after patch embedding. Default: True
class_docstr_tok: ["Swin","Transformer","A","PaddlePaddle","implementation","of",":","`","Swin","Transformer",":","Hierarchical","Vision","Transformer","using","Shifted","Windows","`","-","https",":","\/\/arxiv.org\/pdf\/2103.14030","Args",":","img_size","(","int","|","tuple","[","int","]",",","optional",")",":","Input","image","size",".","Default","224","patch_size","(","int","|","tuple","[","int","]",",","optional",")",":","Patch","size",".","Default",":","4","in_chans","(","int",",","optional",")",":","Number","of","input","image","channels",".","Default",":","3","num_classes","(","int",",","optional",")",":","Number","of","classes","for","classification","head",".","Default",":","1000","embed_dim","(","int",",","optional",")",":","Patch","embedding","dimension",".","Default",":","96","depths","(","tuple","[","int","]",",","optional",")",":","Depth","of","each","Swin","Transformer","layer",".","num_heads","(","tuple","[","int","]",",","optional",")",":","Number","of","attention","heads","in","different","layers",".","window_size","(","int",",","optional",")",":","Window","size",".","Default",":","7","mlp_ratio","(","float",",","optional",")",":","Ratio","of","mlp","hidden","dim","to","embedding","dim",".","Default",":","4","qkv_bias","(","bool",",","optional",")",":","If","True",",","add","a","learnable","bias","to","query",",","key",",","value",".","Default",":","True","qk_scale","(","float",",","optional",")",":","Override","default","query","and","key","scale","of","head_dim","*","*","-0.5","if","set",".","Default",":","None","drop_rate","(","float",",","optional",")",":","Dropout","rate",".","Default",":","0","attn_drop_rate","(","float",",","optional",")",":","Attention","dropout","rate",".","Default",":","0","drop_path_rate","(","float",",","optional",")",":","Stochastic","depth","rate",".","Default",":","0.1","norm_layer","(","nn.Layer",",","optional",")",":","Normalization","layer",".","Default",":","nn.LayerNorm",".","ape","(","bool",",","optional",")",":","If","True",",","add","absolute","position","embedding","to","the","patch","embedding",".","Default",":","False","patch_norm","(","bool",",","optional",")",":","If","True",",","add","normalization","after","patch","embedding",".","Default",":","True"]
docstr: Initialize the parameters of model parts.
docstr_tok: ["Initialize","the","parameters","of","model","parts","."]
code: def init_weight(self):
      """Initialize the parameters of model parts."""
      for sublayer in self.sublayers():
          if isinstance(sublayer, nn.Linear):
              param_init.trunc_normal(sublayer.weight)
              if sublayer.bias is not None:
                  param_init.constant_init(sublayer.bias, value=0.0)
          elif isinstance(sublayer, nn.LayerNorm):
              param_init.constant_init(sublayer.bias, value=0.0)
              param_init.constant_init(sublayer.weight, value=1.0)
  
imports: import numpy
  import paddle
  import paddle.nn
  from medicalseg.cvlibs import manager, param_init
  from medicalseg.utils import load_pretrained_model
  from medicalseg.models.backbones.transformer_utils import DropPath, to_2tuple
label_desc: Use image node_id 2 for calling the SwinTransformer obj's underlying member method code with example usage: obj.init_weight() without return types