code: def train_and_evaluate(model, hparams, train_dataset, test_dataset):
      """Trains the model and returns the evaluation result."""
      model.compile(
          optimizer="adam",
          loss="sparse_categorical_crossentropy",
          metrics=["accuracy"],
      )
      model.fit(
          train_dataset,
          epochs=hparams.epochs,
          steps_per_epoch=hparams.steps_per_epoch,
      )
      eval_result = model.evaluate(
          test_dataset, steps=hparams.eval_steps
      )
      return list(zip(model.metrics_names, eval_result))
  
file_path: neural-structured-learning/neural_structured_learning/examples/adv_keras_cnn_mnist.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl import app
  from absl import flags
  import attr
  import neural_structured_learning
  import tensorflow
label_desc: Use image node_id 7 for calling a global function with example usage: train_and_evaluate(model, hparams, train_dataset, test_dataset) and returns: list