code: def interpolate_positional_embeddings(restored_posemb_grid, n_tokens):
      """Interpolate positional embeddings from one size to another.
  
      Args:
        restored_posemb_grid: Positional embeddings from restored model. Shape is
          [n_restored_tokens, d]. It is assumed that the restored model used square
          image patches.
        n_tokens: Number of tokens in the target model. Can be a scalar if the
          target image is square, otherwise should be a tuple of 2.
  
      Returns:
        positional embedding resized to match n_tokens. Shape is [1, n_tokens, d]
      """
  
      restored_gs = int(np.sqrt(len(restored_posemb_grid)))
      if isinstance(n_tokens, tuple):
          gh, gw = n_tokens
      else:
          if n_tokens == len(restored_posemb_grid):
              # No need to interpolate
              return np.expand_dims(restored_posemb_grid, axis=0)
          gh = int(np.sqrt(n_tokens))
          gw = n_tokens // gh
          assert gh * gw == n_tokens
      logging.info(
          "Resizing grid-size from (%s, %s) to (%s, %s).",
          restored_gs,
          restored_gs,
          gh,
          gw,
      )
      restored_posemb_grid = restored_posemb_grid.reshape(
          restored_gs, restored_gs, -1
      )
      zoom = (gh / restored_gs, gw / restored_gs, 1)
      restored_posemb_grid = scipy.ndimage.zoom(
          restored_posemb_grid, zoom, order=1
      )
      restored_posemb_grid = restored_posemb_grid.reshape(
          1, gh * gw, -1
      )
      return restored_posemb_grid
  
imports: import functools
  import re
  from typing import Any, Callable, Dict, Optional, Sequence, Tuple
  from absl import logging
  import flax
  import flax.linen
  import jax
  import jax.numpy
  import ml_collections
  import numpy
  from scenic.common_lib import debug_utils
  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.classification_model import ClassificationModel
  from scenic.model_lib.layers import nn_layers
  from scenic.projects.av_mae import model_utils
  from scenic.projects.baselines import vit
  from scenic.projects.mbt import model
  from scenic.projects.vivit import model_utils
  import scipy
label_desc: Use image node_id 10 for calling a global function with example usage: interpolate_positional_embeddings(restored_posemb_grid, n_tokens) and returns: restored_posemb_grid, np