code: def import_tower(
      phoenix_spec,
      features,
      input_layer_fn,
      shared_input_tensor,
      original_tower_name,
      new_tower_name,
      model_directory,
      new_model_directory,
      is_training,
      logits_dimension,
      shared_lengths,
      force_snapshot=False,
      force_freeze=False,
      allow_auxiliary_head=False,
  ):
      """Imports a tower from the given model directory and the tower's name.
  
      Args:
        phoenix_spec: The trial's `phoenix_spec_pb2.PhoenixSpec` proto.
        features: feature dict in case the tower needs to create the input tensor
        input_layer_fn: A function that converts feature Tensors to input layer.
          See learning.autolx.model_search.data.Provider.get_input_layer_fn
          for details.
        shared_input_tensor: An input `tf.Tensor` to build the network on top of.
        original_tower_name: a unique name for the tower (string) to import.
        new_tower_name: the name to give the new tower.
        model_directory: string, holds the model directory of the trial to import
          the tower from.
        new_model_directory: the model directory of the current trial.
        is_training: a boolean indicating if we are in training.
        logits_dimension: The last axis dimension of the logits.
        shared_lengths: A `tf.Tensor` with the lengths (dimenions: [batch_size])
          holding the length of each sequence for sequential problems. Keep as None,
          for non sequential problems.
        force_snapshot: Force the tower to be imported from the previous trial even
          if transfer_learning_type is not SNAPSHOT_TRANSFER_LEARNING. This is used
          during ensembling to ensure that the imported towers are always warm
          started.
        force_freeze: Force the imported tower to be frozen. For correctness, only
          force freeze with snapshotting (otherwise, you will freeze an non-trained
          tower).
        allow_auxiliary_head: Whether to allow constructing an auxiliary head for
          the tower if possible. Only applicable for CNNs.
  
      Returns:
        A LogitsSpec containing the main and auxiliary logits and the architecture
        of the underlying tower.
      """
      initial_architecture = get_architecture(
          model_directory, original_tower_name
      )
      dropout_rate = get_parameter(
          model_directory, original_tower_name, DROPOUTS
      )
      is_frozen = get_parameter(
          model_directory, original_tower_name, IS_FROZEN
      )
  
      input_tensor = shared_input_tensor
      lengths = shared_lengths
      hparams = get_hparams_from_dir(
          model_directory, original_tower_name
      )
      if not phoenix_spec.is_input_shared:
          lengths_feature_name = phoenix_spec.lengths_feature_name
          if (
              isinstance(features, dict)
              and lengths_feature_name not in features
          ):
              lengths_feature_name = ""
          input_tensor, lengths = input_layer_fn(
              features=features,
              is_training=is_training,
              scope_name="Phoenix/" + new_tower_name + "/Input",
              lengths_feature_name=lengths_feature_name,
          )
  
      tower_spec = construct_tower(
          phoenix_spec=phoenix_spec,
          input_tensor=input_tensor,
          tower_name=new_tower_name,
          architecture=initial_architecture,
          lengths=lengths,
          is_training=is_training,
          logits_dimension=logits_dimension,
          dropout_rate=dropout_rate,
          hparams=hparams,
          model_directory=new_model_directory,
          is_frozen=(is_frozen or force_freeze),
          allow_auxiliary_head=allow_auxiliary_head,
      )
  
      if force_snapshot:
          init_variables(
              tf.train.latest_checkpoint(model_directory),
              "Phoenix/{}".format(original_tower_name),
              "Phoenix/{}".format(new_tower_name),
          )
      return tower_spec
  
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 17 for calling a global function with example usage: import_tower(phoenix_spec, features, input_layer_fn, shared_input_tensor, original_tower_name, new_tower_name, model_directory, new_model_directory, is_training, logits_dimension, shared_lengths, force_snapshot, force_freeze, allow_auxiliary_head) and returns: tower_spec