def __init__(self, name, serving_input_fn, compare_fn, exports_to_keep=5):
    """Creates a BestModuleExporter to use with tf.estimator.EvalSpec.

    Args:
      name: unique name of this Exporter, which will be used in the export path.
      serving_input_fn: A function with no arguments that returns a
        ServingInputReceiver. LatestModuleExporter does not care about the
        actual behavior of this function, so any return value that looks like a
        ServingInputReceiver is fine.
      compare_fn: A function that compares two evaluation results. It should
        take two arguments, best_eval_result and current_eval_result, and return
        True if the current result is better; False otherwise. See the
        loss_smaller method for an example.
      exports_to_keep: Number of exports to keep. Older exports will be garbage
        collected. Set to None to disable.
    """
    self._compare_fn = compare_fn
    self._best_eval_result = None
    self._latest_module_exporter = hub.LatestModuleExporter(
        name, serving_input_fn, exports_to_keep=exports_to_keep)
Creates a BestModuleExporter to use with tf.estimator.EvalSpec.

    Args:
      name: unique name of this Exporter, which will be used in the export path.
      serving_input_fn: A function with no arguments that returns a
        ServingInputReceiver. LatestModuleExporter does not care about the
        actual behavior of this function, so any return value that looks like a
        ServingInputReceiver is fine.
      compare_fn: A function that compares two evaluation results. It should
        take two arguments, best_eval_result and current_eval_result, and return
        True if the current result is better; False otherwise. See the
        loss_smaller method for an example.
      exports_to_keep: Number of exports to keep. Older exports will be garbage
        collected. Set to None to disable.
    
language/common/utils/exporters.py