import tensorflow as tf

  return hparams


def _terminate_eval():
  tf.logging.info('Timeout passed with no new checkpoints ... terminating eval')
  return True


def _get_next_checkpoint():
  return tf.contrib.training.checkpoints_iterator(
      FLAGS.model_dir,
      timeout=FLAGS.eval_timeout,
      timeout_fn=_terminate_eval)


def _set_or_add_hparam(hparams, name, value):
  if getattr(hparams, name, None) is None:
    hparams.add_hparam(name, value)
