code: def central_frame_init_embedding(
      to_params: Dict[str, Any],
      from_params: Dict[str, Any],
      view_idx: int,
      config: ml_collections.ConfigDict,
  ):
      """Initialize input embedding from a ViT model.
  
      This function is adapted from scenic.projects.vivit.google.model_utils. Here,
      we add support to interpolate the input embeddings if the current model has
      different spatial patch sizes than the pretrained model.
  
      Args:
        to_params: Parameters of the current model.
        from_params: Model parameters where we load the weights from.
        view_idx: View index.
        config: Current model config.
      """
      if config.init_from.get("restore_input_embedding", True):
          name = f"embedding_view{view_idx}"
          input_kernel = to_params[name]["kernel"]
          restored_kernel = from_params["kernel"]
          restored_bias = from_params["bias"]
          logging.info(
              "Initializing input kernel to select centre frame."
          )
          if input_kernel.shape[1:] != restored_kernel.shape:
              logging.info(
                  "Kernel sizes do not match. Interpolation is performed."
              )
              (
                  restored_kernel_h,
                  restored_kernel_w,
                  in_depth,
                  out_depth,
              ) = restored_kernel.shape
              reshaped_kernel = restored_kernel.reshape(
                  restored_kernel_h, restored_kernel_w, -1
              )
              patch_size = config.model.view_configs[
                  view_idx
              ].patches.size
              zoom = (
                  patch_size[0] / restored_kernel_h,
                  patch_size[1] / restored_kernel_w,
                  1,
              )
              resized_kernel = scipy.ndimage.zoom(
                  reshaped_kernel, zoom, order=1
              )
              resized_kernel = resized_kernel.reshape(
                  (patch_size[0], patch_size[1], in_depth, out_depth)
              )
          else:
              resized_kernel = restored_kernel
          central_time_index = input_kernel.shape[0] // 2
          temp = np.zeros(input_kernel.shape)
          temp[central_time_index] = resized_kernel.copy()
          to_params[name]["kernel"] = temp
          to_params[name]["bias"] = restored_bias
  
imports: from typing import Any, Dict, List, Optional, Sequence
  from absl import logging
  import flax
  import jax.numpy
  import ml_collections
  import numpy
  from scenic.projects.vivit import model_utils
  from scenic.train_lib import train_utils
  import scipy.ndimage
label_desc: Use image node_id 7 for calling a global function with example usage: central_frame_init_embedding(to_params, from_params, view_idx, config) without return types