code: def resample_posemb(old, new):
      """Resampling posemb to finetune a ViT on different resolutions."""
      # Rescale the grid of position embeddings. Param shape is (1,N,1024)
      if old.shape == new.shape:
          return old
  
      logging.info("ViT: resize %s to %s", old.shape, new.shape)
      gs_old = int(np.sqrt(old.shape[1]))
      gs_new = int(np.sqrt(new.shape[1]))
      logging.info("ViT: grid-size from %s to %s", gs_old, gs_new)
      grid = old.reshape(gs_old, gs_old, -1)
  
      zoom = (gs_new / gs_old, gs_new / gs_old, 1)
      grid = scipy.ndimage.zoom(grid, zoom, order=1)
      grid = grid.reshape(1, gs_new * gs_new, -1)
      return jnp.array(grid)
  
imports: import functools
  from typing import Any, Optional
  from absl import logging
  import flax
  import flax.linen
  from flax.training import common_utils
  import jax.numpy
  import ml_collections
  import numpy
  from scenic.model_lib.base_models import base_model
  from scenic.model_lib.base_models import classification_model
  from scenic.model_lib.base_models import model_utils
  from scenic.model_lib.base_models import multilabel_classification_model
  from scenic.model_lib.layers import nn_layers
  import scipy
label_desc: Use image node_id 4 for calling a global function with example usage: resample_posemb(old, new) and returns: jnp, old