code: def run(data, base_logdir, session_id, hparams):
      """Run a training/validation session.
  
      Flags must have been parsed for this function to behave.
  
      Args:
        data: The data as loaded by `prepare_data()`.
        base_logdir: The top-level logdir to which to write summary data.
        session_id: A unique string ID for this session.
        hparams: A dict mapping hyperparameters in `HPARAMS` to values.
      """
      model = model_fn(hparams=hparams, seed=session_id)
      logdir = os.path.join(base_logdir, session_id)
  
      callback = tf.keras.callbacks.TensorBoard(
          logdir,
          update_freq=flags.FLAGS.summary_freq,
          profile_batch=0,  # workaround for issue #2084
      )
      hparams_callback = hp.KerasCallback(logdir, hparams)
      ((x_train, y_train), (x_test, y_test)) = data
      result = model.fit(
          x=x_train,
          y=y_train,
          epochs=flags.FLAGS.num_epochs,
          shuffle=False,
          validation_data=(x_test, y_test),
          callbacks=[callback, hparams_callback],
      )
  
file_path: tensorboard/tensorboard/plugins/hparams/hparams_demo.py
imports: import os.path
  import random
  import shutil
  from absl import app
  from absl import flags
  import numpy
  import tensorflow
  from tensorboard.plugins.hparams import api
label_desc: Use image node_id 2 for calling a global function with example usage: run(data, base_logdir, session_id, hparams) without return types