import tensorflow as tf


  if mode == 'eval':
    for checkpoint in _get_next_checkpoint():
      tf.logging.info('Starting to evaluate.')
      try:
        eval_results = image_classifier.evaluate(
            input_fn=imagenet_eval.input_fn,
            steps=eval_steps,
            hooks=eval_hooks,
            checkpoint_path=checkpoint)
        tf.logging.info('Evaluation results: %s' % eval_results)
      except tf.errors.NotFoundError:
        # skip checkpoint if it gets deleted prior to evaluation
        tf.logging.info('Checkpoint %s no longer exists ... skipping')
  elif mode == 'train_and_eval':
    current_step = _load_global_step_from_checkpoint_dir(model_dir)
    tf.logging.info('Starting training at step=%d.' % current_step)
    train_steps_per_eval = int(
        hparams.num_epochs_per_eval * train_steps_per_epoch)
    # Final Evaluation if training is finished.
