Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

tfx.components.trainer.rewriting.converters.RewritingExporter

View source on GitHub

This class invokes the base exporter and a series of rewriters.

tfx.components.trainer.rewriting.converters.RewritingExporter(
    base_exporter, rewriter_inst
)

Args:

  • base_exporter: The exporter of the original model.
  • rewriter_inst: The rewriter instance to invoke. Must inherit from rewriter.BaseRewriter.

Attributes:

  • name: Name of the exporter.

Methods

export

View source

export(
    estimator, export_path, checkpoint_path, eval_result, is_the_final_export
)

Exports the given Estimator to a specific format.

Performs the export as defined by the base_exporter and invokes all of the specified rewriters.

Args:

  • 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.

Returns:

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

Raises:

  • RuntimeError: Unable to create a temporary rewrite directory.