code: def init_variables(checkpoint, original_scope, new_scope):
      """Best effort: Initializes variables in a scope from a checkpoint.
  
      This function aims to warm start variables in a given scope from a
      checkpoint. The function will not fail if a variable was not found in the
      checkpoint. The function will fail if we are trying to warmstart a sharded
      variable from the checkpoint.
  
      Args:
        checkpoint: a filename of a valid TensorFlow checkpoint.
        original_scope: a string holding the scope of the tower in the checkpoint.
        new_scope: a string holding the scope of the tower in the current graph.
  
      Returns:
        The names of the tensors this function was able to warm start.
      """
      var_map = {
          v.op.name: v
          for v in tf.compat.v1.get_collection(
              tf.compat.v1.GraphKeys.GLOBAL_VARIABLES, scope=new_scope
          )
      }
      checkpoint_variables_list = [
          name for name, _ in tf.train.list_variables(checkpoint)
      ]
      no_partion_map = {}
      for var_name, variable in var_map.items():
          # Variable outsize the scope
          if not var_name.startswith(new_scope):
              continue
  
          # Creating the name as it should appear in the checkpoint
          normalized = var_name.replace(new_scope, original_scope)
          if var_name.endswith("/part_0"):
              normalized = normalized[: -len("/part_0")]
  
          # The variable is not in the checkpoint
          if normalized not in checkpoint_variables_list:
              if FLAGS.crash_on_warmstart_error:
                  logging.fatal(
                      "Cannot find %s in the checkpoint", normalized
                  )
              logging.info(
                  "Cannot find %s in the checkpoint", normalized
              )
              continue
          # The variable is in the checkpoint but sharded.
          if var_name.endswith("/part_1"):
              logging.fatal(
                  "Partitioned variables are not allowed in "
                  "init_variables_from_checkpoint_if_exists"
              )
          no_partion_map[normalized] = variable
  
      logging.info("warm starting the following tensors")
      logging.info(no_partion_map)
      tf.compat.v1.train.init_from_checkpoint(
          checkpoint, no_partion_map
      )
      return list(no_partion_map.keys())
  
imports: import collections
  import os
  import string
  import time
  from absl import flags
  from absl import logging
  from model_search import block
  from model_search import block_builder
  from model_search import hparam
  from model_search import utils
  from model_search.proto import hparam_pb2
  from model_search.proto import phoenix_spec_pb2
  from model_search.proto import transfer_learning_spec_pb2
  import numpy
  import tensorflow.compat.v2
  import tf_slim
  from google.protobuf import text_format
label_desc: Use image node_id 14 for calling a global function with example usage: init_variables(checkpoint, original_scope, new_scope) and returns: list