code: def main(params):
      """
      Main program:
        - Build network
        - Prepare dataset
        - Train the model
        - Report accuracy to tuner
      """
      model = MnistModel(
          conv_size=params["conv_size"],
          hidden_size=params["hidden_size"],
          dropout_rate=params["dropout_rate"],
      )
      optimizer = Adam(learning_rate=params["learning_rate"])
      model.compile(
          optimizer=optimizer,
          loss="sparse_categorical_crossentropy",
          metrics=["accuracy"],
      )
      _logger.info("Model built")
  
      (x_train, y_train), (x_test, y_test) = load_dataset()
      _logger.info("Dataset loaded")
  
      model.fit(
          x_train,
          y_train,
          batch_size=params["batch_size"],
          epochs=5,
          verbose=0,
          callbacks=[ReportIntermediates()],
          validation_data=(x_test, y_test),
      )
      _logger.info("Training completed")
  
      loss, accuracy = model.evaluate(x_test, y_test, verbose=0)
      nni.report_final_result(
          accuracy
      )  # send final accuracy to NNI tuner and web UI
      _logger.info("Final accuracy reported: %s", accuracy)
  
file_path: nni/examples/trials/mnist-tfv2/mnist.py
imports: import logging
  import tensorflow
  from tensorflow.keras import Model
  from tensorflow.keras.callbacks import Callback
  from tensorflow.keras.layers import Conv2D, Dense, Dropout, Flatten, MaxPool2D
  from tensorflow.keras.optimizers import Adam
  import nni
label_desc: Use image node_id 2 for calling a global function with example usage: main(params) without return types