code: def init_posembed(
      restored_posemb: jnp.ndarray,
      posemb: jnp.ndarray,
      restored_classifier: str,
      classifier: str,
  ):
      """Initialize positional embedding."""
      if restored_posemb.shape != posemb.shape:
          logging.info(
              "Adapting positional embeddings from %s to %s",
              restored_posemb.shape,
              posemb.shape,
          )
          ntok = posemb.shape[0]
          if restored_classifier == "token":
              # The first token is the CLS token.
              restored_posemb_grid = restored_posemb[1:, :]
              if classifier == "token":
                  # CLS token in restored model and in target.
                  cls_tok = restored_posemb[:1]
                  ntok -= 1
              else:
                  # CLS token in restored model, but not target.
                  cls_tok = restored_posemb[:0]
          else:
              restored_posemb_grid = restored_posemb
              if classifier == "token":
                  # CLS token in target, but not restored model.
                  cls_tok = posemb[:1]
                  ntok -= 1
              else:
                  # CLS token not in target or restored model.
                  cls_tok = restored_posemb[:0]
          restored_posemb_grid = (
              vivit_utils.interpolate_positional_embeddings(
                  restored_posemb_grid, ntok
              )[0]
          )  # Squeeze first dimension.
          # Attach the CLS token again.
          if classifier == "token":
              restored_posemb = jnp.array(
                  np.concatenate(
                      [cls_tok, restored_posemb_grid], axis=0
                  )
              )
          else:
              restored_posemb = restored_posemb_grid
  
      return restored_posemb
  
imports: from typing import Any, Dict, List, Mapping, Optional, Sequence, Union
  from absl import logging
  import flax
  import jax
  import jax.numpy
  import ml_collections
  import numpy
  from scenic.projects.vivit import model_utils
  from scenic.train_lib import train_utils
label_desc: Use image node_id 11 for calling a global function with example usage: init_posembed(restored_posemb, posemb, restored_classifier, classifier) and returns: restored_posemb