code: def build_model_with_architecture(architecture_parameters):
      # [filter_number, convolution_kernel_size, max_polling_size]
      # Example: architecture_parameters = [32, 3, 2, 64, 3, 2]
  
      img_rows, img_cols = 28, 28
      input_shape = (img_rows, img_cols, 1)
      num_classes = 10
  
      layer_number = int(len(architecture_parameters) / 3)
  
      model = Sequential()
      for layer_index in range(layer_number):
          filter_number = architecture_parameters[0 + layer_index * 3]
          convolution_kernel_size = architecture_parameters[
              1 + layer_index * 3
          ]
          max_polling_size = architecture_parameters[
              2 + layer_index * 3
          ]
  
          if layer_index == 0:
              model.add(
                  Conv2D(
                      filter_number,
                      kernel_size=(
                          convolution_kernel_size,
                          convolution_kernel_size,
                      ),
                      activation="relu",
                      input_shape=input_shape,
                  )
              )
          else:
              model.add(
                  Conv2D(
                      filter_number,
                      kernel_size=(
                          convolution_kernel_size,
                          convolution_kernel_size,
                      ),
                      activation="relu",
                  )
              )
          model.add(
              MaxPooling2D(
                  pool_size=(max_polling_size, max_polling_size)
              )
          )
  
      model.add(Flatten())
      model.add(Dense(num_classes, activation="softmax"))
      return model
  
file_path: advisor/examples/keras/mnist_cnn.py
imports: from __future__ import print_function
  import keras
  from keras.datasets import mnist
  from keras.models import Sequential
  from keras.layers import Input, Dense, Dropout, Flatten, GlobalAveragePooling2D
  from keras.layers import Conv2D, MaxPooling2D
  from keras import backend
  from keras.models import Model
label_desc: Use image node_id 3 for calling a global function with example usage: build_model_with_architecture(architecture_parameters) and returns: model