class_docstr: Implements Swin Transformer from the `"Swin Transformer: Hierarchical Vision Transformer using
  Shifted Windows" <https://arxiv.org/abs/2103.14030>`_ paper.
  Args:
      patch_size (List[int]): Patch size.
      embed_dim (int): Patch embedding dimension.
      depths (List(int)): Depth of each Swin Transformer layer.
      num_heads (List(int)): Number of attention heads in different layers.
      window_size (List[int]): Window size.
      mlp_ratio (float): Ratio of mlp hidden dim to embedding dim. Default: 4.0.
      dropout (float): Dropout rate. Default: 0.0.
      attention_dropout (float): Attention dropout rate. Default: 0.0.
      stochastic_depth_prob (float): Stochastic depth rate. Default: 0.1.
      num_classes (int): Number of classes for classification head. Default: 1000.
      block (nn.Module, optional): SwinTransformer Block. Default: None.
      norm_layer (nn.Module, optional): Normalization layer. Default: None.
      downsample_layer (nn.Module): Downsample layer (patch merging). Default: PatchMerging.
class_docstr_tok: ["Implements","Swin","Transformer","from","the","`","``","Swin","Transformer",":","Hierarchical","Vision","Transformer","using","Shifted","Windows","''","<","https",":","\/\/arxiv.org\/abs\/2103.14030",">","`","_","paper",".","Args",":","patch_size","(","List","[","int","]",")",":","Patch","size",".","embed_dim","(","int",")",":","Patch","embedding","dimension",".","depths","(","List","(","int",")",")",":","Depth","of","each","Swin","Transformer","layer",".","num_heads","(","List","(","int",")",")",":","Number","of","attention","heads","in","different","layers",".","window_size","(","List","[","int","]",")",":","Window","size",".","mlp_ratio","(","float",")",":","Ratio","of","mlp","hidden","dim","to","embedding","dim",".","Default",":","4.0.","dropout","(","float",")",":","Dropout","rate",".","Default",":","0.0.","attention_dropout","(","float",")",":","Attention","dropout","rate",".","Default",":","0.0.","stochastic_depth_prob","(","float",")",":","Stochastic","depth","rate",".","Default",":","0.1.","num_classes","(","int",")",":","Number","of","classes","for","classification","head",".","Default",":","1000.","block","(","nn.Module",",","optional",")",":","SwinTransformer","Block",".","Default",":","None",".","norm_layer","(","nn.Module",",","optional",")",":","Normalization","layer",".","Default",":","None",".","downsample_layer","(","nn.Module",")",":","Downsample","layer","(","patch","merging",")",".","Default",":","PatchMerging","."]
code: def forward(self, x):
      x = self.features(x)
      x = self.norm(x)
      x = self.permute(x)
      x = self.avgpool(x)
      x = self.flatten(x)
      x = self.head(x)
      return x
  
imports: import math
  from functools import partial
  from typing import Any, Callable, List, Optional
  import torch
  import torch.nn.functional
  from torch import nn, Tensor
  from ..ops.misc import MLP, Permute
  from ..ops.stochastic_depth import StochasticDepth
  from ..transforms._presets import ImageClassification, InterpolationMode
  from ..utils import _log_api_usage_once
  from ._api import register_model, Weights, WeightsEnum
  from ._meta import _IMAGENET_CATEGORIES
  from ._utils import _ovewrite_named_param, handle_legacy_interface
label_desc: Use image node_id 2 for calling the SwinTransformer obj's underlying member method code with example usage: obj.forward(x) and returns: x