code: def main(client, trial):
      batch_size = 32
      num_classes = 10
      epochs = trial.parameters.get("epochs", 15)
  
      # the data, shuffled and split between train and test sets
      (x_train, y_train), (x_test, y_test) = mnist.load_data()
  
      x_train = x_train.reshape(60000, 784)
      x_test = x_test.reshape(10000, 784)
      x_train = x_train.astype("float32")
      x_test = x_test.astype("float32")
      x_train /= 255
      x_test /= 255
      print(x_train.shape[0], "train samples")
      print(x_test.shape[0], "test samples")
  
      # convert class vectors to binary class matrices
      y_train = keras.utils.to_categorical(y_train, num_classes)
      y_test = keras.utils.to_categorical(y_test, num_classes)
  
      # Create new model.
      model = define_model(trial.parameters)
  
      model.fit(
          x_train,
          y_train,
          batch_size=batch_size,
          epochs=epochs,
          verbose=2,
          callbacks=[
              client.keras_send_metrics(
                  trial,
                  objective_name="val_loss",
                  context_names=["val_acc"],
              )
          ],
          validation_data=(x_test, y_test),
      )
  
file_path: sherpa/examples/parallel-examples/mnistmlp/trial.py
imports: from __future__ import print_function
  import os
  import sherpa
  import keras
  from keras.models import Model
  from keras.layers import Dense, Input, Dropout
  from keras.optimizers import SGD
  from keras.datasets import mnist
label_desc: Use image node_id 2 for calling a global function with example usage: main(client, trial) without return types