code: def init_encoderblock(to_params, from_params, tm_key):
      """Initialize encoder_block_parameters."""
      # Explicitly enumerate over the keys in the encoder-block. Don't just
      # assign the dictionary. It is possible for the target model to
      # contain keys that are not in the restored model.
      for enc_key in from_params[tm_key].keys():
          if tm_key in to_params["vit_encoder"]:
              to_params["vit_encoder"][tm_key][enc_key] = from_params[
                  tm_key
              ][enc_key]
          else:
              for tokenizer_name in [
                  "tokenizer2d",
                  "tokenizer3d",
                  "tokenizer_spec",
              ]:
                  if tokenizer_name in to_params["tokenizer"]:
                      to_params["tokenizer"][tokenizer_name][tm_key][
                          enc_key
                      ] = from_params[tm_key][enc_key]
  
file_path: scenic/scenic/projects/polyvit/model_utils.py
imports: from typing import Any, Optional
  from absl import logging
  import flax
  import jax.numpy
  import ml_collections
  import numpy
  from scenic.common_lib import debug_utils
  import scenic.projects.mbt.model_utils
  import scenic.projects.vivit.model_utils
  import scipy
label_desc: Use image node_id 7 for calling a global function with example usage: init_encoderblock(to_params, from_params, tm_key) without return types