code: def resize_pos_embed(posemb, posemb_new):
      """
      Rescale the grid of position embeddings when loading from state_dict
      Expected shape of position embeddings is (1, T, N, C), and considers only square images
      """
      _logger.info(
          "Resized position embedding: %s to %s",
          posemb.shape,
          posemb_new.shape,
      )
      seq_length_old = posemb.shape[2]
      num_blocks_new, seq_length_new = posemb_new.shape[1:3]
      size_new = int(math.sqrt(num_blocks_new * seq_length_new))
      # First change to (1, C, H, W)
      posemb = deblockify(
          posemb, int(math.sqrt(seq_length_old))
      ).permute(0, 3, 1, 2)
      posemb = F.interpolate(
          posemb,
          size=[size_new, size_new],
          mode="bicubic",
          align_corners=False,
      )
      # Now change to new (1, T, N, C)
      posemb = blockify(
          posemb.permute(0, 2, 3, 1), int(math.sqrt(seq_length_new))
      )
      return posemb
  
imports: import collections.abc
  import logging
  import math
  from functools import partial
  import torch
  import torch.nn.functional
  from torch import nn
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
  from timm.layers import PatchEmbed, Mlp, DropPath, create_classifier, trunc_normal_, _assert
  from timm.layers import create_conv2d, create_pool2d, to_ntuple, use_fused_attn, LayerNorm
  from ._builder import build_model_with_cfg
  from ._features_fx import register_notrace_function
  from ._manipulate import checkpoint_seq, named_apply
  from ._registry import register_model, generate_default_cfgs, register_model_deprecations
label_desc: Use image node_id 4 for calling a global function with example usage: resize_pos_embed(posemb, posemb_new) and returns: posemb