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
      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.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
code: def forward_features(self, x: torch.Tensor):
      x = self.patch_embed(x)
      if self.ape:
          pos_embed = self.interpolate_pos_encoding(
              x, self.absolute_pos_embed
          )
          x = x + pos_embed
      x = self.pos_drop(x)
  
      for layer in self.layers:
          x = layer(x)
  
      B, feat_c, feat_h, feat_w = x.shape
      x = x.permute((0, 2, 3, 1)).reshape((B, -1, feat_c))
      x = self.norm(x)  # B L C
      x = self.avgpool(x.transpose(1, 2))  # B C 1
      x = torch.flatten(x, start_dim=1)
      return x
  
imports: import math
  from functools import lru_cache
  from typing import List, Optional
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.utils.checkpoint
  from vissl.config import AttrDict
  from vissl.models.model_helpers import DropPath, rearrange, to_2tuple, trunc_normal_
  from vissl.models.trunks import register_model_trunk
label_desc: Use image node_id 5 for calling the SwinTransformer obj's underlying member method code with example usage: obj.forward_features(x) and returns: x