class_docstr: Vision Transformer with support for patch input
      
class_docstr_tok: ["Vision","Transformer","with","support","for","patch","input"]
docstr: Resize pos_embed weight.
  Args:
      pos_embed (Tensor): the pos_embed weight
      old_hw (list[int]): the height and width of old pos_embed
      new_hw (list[int]): the height and width of new pos_embed
  Returns:
      Tensor: the resized pos_embed weight
code: def resize_pos_embed(self, pos_embed, old_hw, new_hw):
      """
      Resize pos_embed weight.
      Args:
          pos_embed (Tensor): the pos_embed weight
          old_hw (list[int]): the height and width of old pos_embed
          new_hw (list[int]): the height and width of new pos_embed
      Returns:
          Tensor: the resized pos_embed weight
      """
      cls_pos_embed = pos_embed[:, :1, :]
      pos_embed = pos_embed[:, 1:, :]
  
      pos_embed = pos_embed.transpose([0, 2, 1])
      pos_embed = pos_embed.reshape([1, -1, old_hw[0], old_hw[1]])
      pos_embed = F.interpolate(
          pos_embed, new_hw, mode="bicubic", align_corners=False
      )
      pos_embed = pos_embed.flatten(2).transpose([0, 2, 1])
      pos_embed = paddle.concat([cls_pos_embed, pos_embed], axis=1)
  
      return pos_embed
  
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
  import numpy
  import math
  from paddle import ParamAttr
  from paddle.regularizer import L2Decay
  from paddle.nn.initializer import Constant, TruncatedNormal
  from ppdet.modeling.shape_spec import ShapeSpec
  from ppdet.core.workspace import register, serializable
  from .transformer_utils import zeros_, DropPath, Identity, window_partition, window_unpartition
  from ..initializer import linear_init_
label_desc: Use image node_id 5 for calling the VisionTransformer2D obj's underlying member method code with example usage: obj.resize_pos_embed(pos_embed, old_hw, new_hw) and returns: pos_embed