class_docstr: Vision Transformer.
  
  A PyTorch impl of : `An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale`
      - https://arxiv.org/abs/2010.11929
  
  Includes distillation token & head support for `DeiT: Data-efficient Image Transformers`
      - https://arxiv.org/abs/2012.12877
class_docstr_tok: ["Vision","Transformer",".","A","PyTorch","impl","of",":","`","An","Image","is","Worth","16x16","Words",":","Transformers","for","Image","Recognition","at","Scale","`","-","https",":","\/\/arxiv.org\/abs\/2010.11929","Includes","distillation","token","&","head","support","for","`","DeiT",":","Data-efficient","Image","Transformers","`","-","https",":","\/\/arxiv.org\/abs\/2012.12877"]
docstr: Resize pos_embed weights.
  
  Resize pos_embed using bicubic interpolate method.
  Args:
      pos_embed (torch.Tensor): Position embedding weights.
      input_shpae (tuple): Tuple for (downsampled input image height,
          downsampled input image width).
      pos_shape (tuple): The resolution of downsampled origin training
          image.
      mode (str): Algorithm used for upsampling:
          ``'nearest'`` | ``'linear'`` | ``'bilinear'`` | ``'bicubic'`` |
          ``'trilinear'``. Default: ``'nearest'``
  Return:
      torch.Tensor: The resized pos_embed of shape [B, L_new, C]
docstr_tok: ["Resize","pos_embed","weights",".","Resize","pos_embed","using","bicubic","interpolate","method",".","Args",":","pos_embed","(","torch.Tensor",")",":","Position","embedding","weights",".","input_shpae","(","tuple",")",":","Tuple","for","(","downsampled","input","image","height",",","downsampled","input","image","width",")",".","pos_shape","(","tuple",")",":","The","resolution","of","downsampled","origin","training","image",".","mode","(","str",")",":","Algorithm","used","for","upsampling",":","``","'nearest","'","``","|","``","'linear","'","``","|","``","'bilinear","'","``","|","``","'bicubic","'","``","|","``","'trilinear","'","``",".","Default",":","``","'nearest","'","``","Return",":","torch.Tensor",":","The","resized","pos_embed","of","shape","[","B",",","L_new",",","C","]"]
code: def resize_pos_embed(pos_embed, input_shpae, pos_shape, mode):
      """Resize pos_embed weights.
  
      Resize pos_embed using bicubic interpolate method.
      Args:
          pos_embed (torch.Tensor): Position embedding weights.
          input_shpae (tuple): Tuple for (downsampled input image height,
              downsampled input image width).
          pos_shape (tuple): The resolution of downsampled origin training
              image.
          mode (str): Algorithm used for upsampling:
              ``'nearest'`` | ``'linear'`` | ``'bilinear'`` | ``'bicubic'`` |
              ``'trilinear'``. Default: ``'nearest'``
      Return:
          torch.Tensor: The resized pos_embed of shape [B, L_new, C]
      """
      assert pos_embed.ndim == 3, "shape of pos_embed must be [B, L, C]"
      pos_h, pos_w = pos_shape
      # keep dim for easy deployment
      cls_token_weight = pos_embed[:, 0:1]
      pos_embed_weight = pos_embed[:, (-1 * pos_h * pos_w) :]
      pos_embed_weight = pos_embed_weight.reshape(
          1, pos_h, pos_w, pos_embed.shape[2]
      ).permute(0, 3, 1, 2)
      pos_embed_weight = resize(
          pos_embed_weight,
          size=input_shpae,
          align_corners=False,
          mode=mode,
      )
      pos_embed_weight = torch.flatten(pos_embed_weight, 2).transpose(
          1, 2
      )
      pos_embed = torch.cat((cls_token_weight, pos_embed_weight), dim=1)
      return pos_embed
  
imports: import logging
  import math
  from functools import partial
  from itertools import repeat
  from typing import Callable, Optional
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.utils.checkpoint
  from mmcv.runner import BaseModule, load_checkpoint
  from mmseg.ops import resize
  from mmseg.utils import get_root_logger
  from torch import Tensor
  from .drop_path import DropPath
label_desc: Use image node_id 5 for calling the TIMMVisionTransformer obj's underlying member method code with example usage: obj.resize_pos_embed(pos_embed, input_shpae, pos_shape, mode) and returns: pos_embed