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
docstr: Interpolate the positional embeddings to the correct image resolution
  used for 'x': so we can use a 224x224 model to handle 96x96 inputs
docstr_tok: ["Interpolate","the","positional","embeddings","to","the","correct","image","resolution","used","for","'","x","'",":","so","we","can","use","a","224x224","model","to","handle","96x96","inputs"]
code: def interpolate_pos_encoding(
      self, x: torch.Tensor, pos_embed: torch.Tensor
  ) -> torch.Tensor:
      """
      Interpolate the positional embeddings to the correct image resolution
      used for 'x': so we can use a 224x224 model to handle 96x96 inputs
      """
      npatch = x.shape[1]
      N = pos_embed.shape[1]
      if npatch == N:
          return pos_embed
  
      dim = x.shape[-1]
      pos_embed = F.interpolate(
          pos_embed.reshape(
              1, int(math.sqrt(N)), int(math.sqrt(N)), dim
          ).permute(0, 3, 1, 2),
          scale_factor=math.sqrt(npatch / N),
          mode="bicubic",
      )
      pos_embed = pos_embed.permute(0, 2, 3, 1).view(1, -1, dim)
      return pos_embed
  
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 8 for calling the SwinTransformer obj's underlying member method code with example usage: obj.interpolate_pos_encoding(x, pos_embed) and returns: pos_embed, pos_embed