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)
  eval_result = model.evaluate(test_dataset)
  return list(zip(model.metrics_names, eval_result))