code: def build_model(hp):
      inputs = keras.Input(shape=(28, 28))
      x = keras.layers.Reshape((28 * 28,))(inputs)
      for i in range(hp.Int("num_layers", 1, 4)):
          x = keras.layers.Dense(
              units=hp.Int(
                  f"units_{str(i)}", 128, 512, 32, default=256
              ),
              activation="relu",
          )(x)
  
      x = keras.layers.Dropout(
          hp.Float("dp", 0.0, 0.6, 0.1, default=0.5)
      )(x)
      outputs = keras.layers.Dense(10, activation="softmax")(x)
      model = keras.Model(inputs, outputs)
      model.compile(
          optimizer=keras.optimizers.Adam(
              hp.Choice("learning_rate", [1e-2, 2e-3, 5e-4])
          ),
          loss="sparse_categorical_crossentropy",
          metrics=["accuracy"],
      )
      return model
  
imports: import numpy
  import keras_tuner
  from keras_tuner.backend import keras
label_desc: Use image node_id 2 for calling a global function with example usage: build_model(hp) and returns: model