code: def evaluate(estimator, eval_args):
    
    values = {}  # Default return value if evaluation fails.
  
    checkpoint_path = estimator.latest_checkpoint()
    if not checkpoint_path:
      # This is expected if the training job has not yet saved a checkpoint.
      return values
  
    tf.logging.info("Starting evaluation on checkpoint %s", checkpoint_path)
    for eval_name in eval_args:
      input_fn, eval_steps = eval_args[eval_name]
      metric_values = estimator.evaluate(
          input_fn,
          steps=eval_steps,
          name=eval_name,
          checkpoint_path=checkpoint_path)
      for key, val in metric_values.iteritems():
        values[eval_name + "/" + key] = val
  
    tf.logging.info(values)
    return values
docs: Runs evaluation on the latest model checkpoint & logs to tensorboard.
  
    Args:
      estimator: A tf.Estimator object.
      eval_args: Dictionary of {eval_name: (input_fn, eval_steps)} where eval_name
        is the name of the evaluation set, e.g. "train" or "val", input_fn is an
        input function returning a tuple (features, labels), and eval_steps is the
        number of steps for which to evaluate the model. If None, evaluates until
        input_fn raises an end-of-input exception.
  
    Returns:
      A dict of metric values from the evaluation. May be empty, e.g. if the
      training job has not yet saved a checkpoint or the checkpoint is deleted by
      the time the TPU worker initializes.