code: def resample_abs_pos_embed_nhwc(
      posemb,
      new_size: List[int],
      interpolation: str = "bicubic",
      antialias: bool = True,
      verbose: bool = False,
  ):
      if (
          new_size[0] == posemb.shape[-3]
          and new_size[1] == posemb.shape[-2]
      ):
          return posemb
  
      orig_dtype = posemb.dtype
      posemb = posemb.float()
      # do the interpolation
      posemb = posemb.reshape(
          1, posemb.shape[-3], posemb.shape[-2], posemb.shape[-1]
      ).permute(0, 3, 1, 2)
      posemb = F.interpolate(
          posemb, size=new_size, mode=interpolation, antialias=antialias
      )
      posemb = posemb.permute(0, 2, 3, 1).to(orig_dtype)
  
      if not torch.jit.is_scripting() and verbose:
          _logger.info(
              f"Resized position embedding: {posemb.shape[-3:-1]} to {new_size}."
          )
  
      return posemb
  
file_path: pytorch-image-models/timm/layers/pos_embed.py
imports: import logging
  import math
  from typing import List, Tuple, Optional, Union
  import torch
  import torch.nn.functional
  from .helpers import to_2tuple
label_desc: Use image node_id 2 for calling a global function with example usage: resample_abs_pos_embed_nhwc(posemb, new_size, interpolation, antialias, verbose) and returns: posemb, posemb