Save the date! Google I/O returns May 18-20 Register now


TensorFlow 1 version View source on GitHub

This class exports the serving graph and checkpoints of the best models.

Inherits From: Exporter

This class performs a model export everytime the new model is better than any existing model.

name unique name of this Exporter that is going to be used in the export path.
serving_input_receiver_fn a function that takes no arguments and returns a ServingInputReceiver.
event_file_pattern event file name pattern relative to model_dir. If None, however, the exporter would not be preemption-safe. To be preemption-safe, event_file_pattern must be specified.
compare_fn a function that compares two evaluation results and returns true if current evaluation result is better. Follows the signature:

  • Args:
  • best_eval_result: This is the evaluation result of the best model.
  • current_eval_result: This is the evaluation result of current candidate model.
  • Returns: True if current evaluation result is better; otherwise, False.
assets_extra An optional dict specifying how to populate the assets.extra directory within the exported SavedModel. Each key should give the destination path (including the filename) relative to the assets.extra directory. The corresponding value gives the full path of the source file to be copied. For example, the simple case of copying a single file without renaming it is specified as {'my_asset_file.txt': '/path/to/my_asset_file.txt'}.
as_text whether to write the SavedModel proto in text format. Defaults to False.
exports_to_keep Number of exports to keep. Older exports will be garbage-collected. Defaults to 5. Set to None to disable garbage collection.

ValueError if any argument is invalid.

name Directory name.

A directory name under the export base directory where exports of this type are written. Should not be None nor empty.



View source

Exports the given Estimator to a specific format.

estimator the Estimator to export.
export_path A string containing a directory where to write the export.
checkpoint_path The checkpoint path to export.
eval_result The output of Estimator.evaluate on this checkpoint.
is_the_final_export This boolean is True when this is an export in the end of training. It is False for the intermediate exports during the training. When passing Exporter to tf.estimator.train_and_evaluate is_the_final_export is always False if TrainSpec.max_steps is None.

The string path to the exported directory or None if export is skipped.