tf.estimator.experimental.InMemoryEvaluatorHook

Hook to run evaluation in training without a checkpoint.

Inherits From: SessionRunHook

Example:

def train_input_fn():
  ...
  return train_dataset

def eval_input_fn():
  ...
  return eval_dataset

estimator = tf.estimator.DNNClassifier(...)

evaluator = tf.estimator.experimental.InMemoryEvaluatorHook(
    estimator, eval_input_fn)
estimator.train(train_input_fn, hooks=[evaluator])

Current limitations of this approach are:

  • It doesn't support multi-node distributed mode.
  • It doesn't support saveable objects other than variables (such as boosted tree support)
  • It doesn't support custom saver logic (such as ExponentialMovingAverage support)

estimator A tf.estimator.Estimator instance to call evaluate.
input_fn Equivalent to the input_fn arg to