class_docstr: Swin Transformer
      A PyTorch impl of : `Swin Transformer: Hierarchical Vision Transformer using Shifted Windows`  -
        https://arxiv.org/pdf/2103.14030
  Args:
      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
      num_classes (int): Number of classes for classification head. Default: 1000
      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
      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.Module): 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
      use_checkpoint (bool): Whether to use checkpointing to save memory. Default: False
      pretrained_window_sizes (tuple(int)): Pretrained window sizes of each layer.
class_docstr_tok: ["Swin","Transformer","A","PyTorch","impl","of",":","`","Swin","Transformer",":","Hierarchical","Vision","Transformer","using","Shifted","Windows","`","-","https",":","\/\/arxiv.org\/pdf\/2103.14030","Args",":","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","num_classes","(","int",")",":","Number","of","classes","for","classification","head",".","Default",":","1000","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","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.Module",")",":","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","use_checkpoint","(","bool",")",":","Whether","to","use","checkpointing","to","save","memory",".","Default",":","False","pretrained_window_sizes","(","tuple","(","int",")",")",":","Pretrained","window","sizes","of","each","layer","."]
code: def forward(self, x):
      x = self.forward_features(x)
      x = self.head(x)
      return x
  
file_path: towhee/towhee/models/swin_transformer/model.py
imports: import math
  import torch
  from torch import nn
  from towhee.models.utils.weight_init import trunc_normal_
  from towhee.models.layers.patch_embed2d import PatchEmbed2D
  from towhee.models.layers.patch_merging import PatchMerging
  from towhee.models.utils.init_vit_weights import init_vit_weights
  from towhee.models.swin_transformer.basic_layer import BasicLayer
label_desc: Use image node_id 7 for calling the SwinTransformer obj's underlying member method code with example usage: obj.forward(x) and returns: x