code: def restore_from_checkpoint(
      directory, tower_name="search_generator_0"
  ):
      """Given a trial directory and a tower name, returns its architecture.
  
      Args:
        directory: string - a model directory (that includes checkpoints).
        tower_name: string - the tower name we are trying to retrieve the
          architecutre for.
  
      Returns:
        np.array of ints holding the architecture of the Phoenix tower.
      """
  
      checkpoint = tf.train.latest_checkpoint(directory)
      trials = 3
      while checkpoint is None and trials >= 1:
          checkpoint = tf.train.latest_checkpoint(directory)
          time.sleep(1)
          trials -= 1
  
      reader = tf.compat.v1.train.NewCheckpointReader(checkpoint)
  
      input_indices_padded_np = reader.get_tensor(
          "architectures/{}/{}".format(
              tower_name, INPUT_INDICES_PADDED_TENSOR_NAME
          )
      )
      input_indices_lengths_np = reader.get_tensor(
          "architectures/{}/{}".format(
              tower_name, INPUT_INDICES_LENGTHS_TENSOR_NAME
          )
      )
      input_indices_lengths = input_indices_lengths_np.tolist()
      input_indices_padded_list = input_indices_padded_np.tolist()
      input_indices_list = []
      for input_indices_length, input_indices_padded in zip(
          input_indices_lengths, input_indices_padded_list
      ):
          input_indices_list.append(
              input_indices_padded[:input_indices_length]
          )
  
      combiner_types_np = reader.get_tensor(
          "architectures/{}/{}".format(
              tower_name, COMBINER_TYPES_TENSOR_NAME
          )
      )
      combiner_types = combiner_types_np.tolist()
  
      block_types_np = reader.get_tensor(
          "architectures/{}/{}".format(
              tower_name, BLOCK_TYPES_TENSOR_NAME
          )
      )
      block_types = block_types_np.tolist()
  
      input_keys_np = reader.get_tensor(
          "architectures/{}/{}".format(
              tower_name, INPUT_KEYS_TENSOR_NAME
          )
      )
      input_keys_b = input_keys_np.tolist()
      if input_keys_b:
          input_keys = [
              input_key_b.decode() for input_key_b in input_keys_b
          ]
      else:
          input_keys = None
  
      node_list = []
      for input_indices, combiner_type, block_type in zip(
          input_indices_list, combiner_types, block_types
      ):
          node_list.append(
              Node(block_type, input_indices, combiner_type)
          )
      return Architecture(node_list, input_keys)
  
imports: import abc
  import collections
  import enum
  import time
  from absl import logging
  from model_search import block_builder
  from model_search import utils
  from model_search.architecture import architecture_utils
  from model_search.proto import phoenix_spec_pb2
  import tensorflow.compat.v2
label_desc: Use image node_id 3 for calling a global function with example usage: restore_from_checkpoint(directory, tower_name) and returns: Architecture