code: def init_embedding(
      to_params, from_params, init_config, model_config, name
  ):
      """Initialize input embedding."""
      if name not in to_params:
          logging.info("No %s in target model", name)
      elif init_config.get("restore_input_embedding", True):
          input_kernel = to_params[name]["kernel"]
          restored_kernel = from_params["kernel"]
          restored_bias = from_params["bias"]
  
          if input_kernel.shape != restored_kernel.shape:
              kernel_init_method = (
                  model_config.temporal_encoding_config.kernel_init_method
              )
              if input_kernel.shape == restored_kernel.shape[1:]:
                  # Deflates a ViViT 3D embedder to work with 2D spectrogram inputs.
                  restored_kernel = np.mean(restored_kernel, axis=0)
              elif input_kernel.shape[1:] != restored_kernel.shape:
                  # Kernel dimensions are [t, c_in, c_out]
                  restored_kernel = np.reshape(
                      restored_kernel, input_kernel.shape
                  )
              elif input_kernel.shape[0] == 1:
                  # Kernel dimensions are [t, h, w, c_in, c_out]
                  restored_kernel = np.expand_dims(
                      restored_kernel, axis=0
                  )
              elif kernel_init_method == "average_frame_initializer":
                  # This corresponds to "filter inflation" in
                  # J Carreira and A Zisserman. Quo vadis, action recognition?
                  # A new model and the kinetics dataset. CVPR 2017"
                  logging.info(
                      "Initializing input kernel with filter inflation."
                  )
                  t = input_kernel.shape[0]
                  restored_kernel = np.expand_dims(
                      restored_kernel, axis=0
                  )
                  restored_kernel = (
                      np.tile(restored_kernel, [t, 1, 1, 1, 1]) / t
                  )
              elif kernel_init_method == "central_frame_initializer":
                  logging.info(
                      "Initializing input kernel to select centre frame."
                  )
                  central_time_index = input_kernel.shape[0] // 2
                  temp = np.zeros(input_kernel.shape)
                  temp[central_time_index] = restored_kernel.copy()
                  restored_kernel = temp
              else:
                  raise AssertionError(
                      "Unknown input kernel initialization {}".format(
                          kernel_init_method
                      )
                  )
  
          to_params[name]["kernel"] = restored_kernel
          to_params[name]["bias"] = restored_bias
      else:
          logging.info("Not restoring input embedding parameters")
  
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 12 for calling a global function with example usage: init_embedding(to_params, from_params, init_config, model_config, name) without return types