code: def fix_architecture_order(architecture, problem_type):
      """Fixes the architecture order of cnns.
  
      This function fixes the architecture for convolutional neural networks.
      Namely, if a dense block is before a convolutional block, then it switches
      the order. For the dnn and rnn case, the function doesn't do anything for
      the architecture as all architectures are valid.
  
      Args:
        architecture: an iterable of integers or `block_builder.BlockType`.
        problem_type: a `PhoenixSpec.ProblemType` enum.
  
      Returns:
        a list of `block_builder.BlockType`.
      """
      # All achitectures are valid in the dnn and rnn case.
      if problem_type != phoenix_spec_pb2.PhoenixSpec.CNN:
          return architecture
  
      output_architecture = []
      flattens = tuple(
          block
          for block in architecture
          if "FLATTEN" in block_builder.BlockType(block).name
      )
      if not flattens:
          output_architecture = [
              block_builder.BlockType.PLATE_REDUCTION_FLATTEN
          ]
          logging.warning(
              "initial_architecture does not have a flattening "
              "block."
          )
          logging.info("Adding a Flatten block to the architecture.")
      else:
          output_architecture = [flattens[0]]
  
      for block in architecture:
          if (
              block == block_builder.BlockType.FLATTEN
              or block == block_builder.BlockType.DOWNSAMPLE_FLATTEN
              or block
              == block_builder.BlockType.PLATE_REDUCTION_FLATTEN
          ):
              continue
          output_architecture = increase_structure_depth(
              np.array(output_architecture), block, problem_type
          )
          output_architecture = [i.item() for i in output_architecture]
      return [block_builder.BlockType(i) for i in output_architecture]
  
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 12 for calling a global function with example usage: fix_architecture_order(architecture, problem_type) and returns: unknown, architecture