contrib.learn.ExportStrategy

tf.contrib.learn.ExportStrategy

class tf.contrib.learn.ExportStrategy

Defined in tensorflow/contrib/learn/python/learn/export_strategy.py.

See the guide: Learn (contrib) > Distributed training utilities

A class representing a type of model export.

Typically constructed by a utility function specific to the exporter, such as saved_model_export_utils.make_export_strategy().

The fields are: name: The directory name under the export base directory where exports of this type will be written. export_fn: A function that writes an export, given an estimator, a destination path, and optionally a checkpoint path and an evaluation result for that checkpoint. This export_fn() may be run repeatedly during continuous training, or just once at the end of fixed-length training. Note the export_fn() may choose whether or not to export based on the eval result or based on an internal timer or any other criterion, if exports are not desired for every checkpoint.

The signature of this function must be one of:

  • (estimator, export_path) -> export_path
  • (estimator, export_path, checkpoint_path) -> export_path
  • (estimator, export_path, checkpoint_path, eval_result) -> export_path

Properties

export_fn

Alias for field number 1

name

Alias for field number 0

Methods

__new__

__new__(
    _cls,
    name,
    export_fn
)

Create new instance of ExportStrategy(name, export_fn)

export

export(
    estimator,
    export_path,
    checkpoint_path=None,
    eval_result=None
)

Exports the given Estimator to a specific format.

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. If None (the default), the strategy may locate a checkpoint (e.g. the most recent) by itself.
  • eval_result: The output of Estimator.evaluate on this checkpoint. This should be set only if checkpoint_path is provided (otherwise it is unclear which checkpoint this eval refers to).

Returns:

The string path to the exported directory.

Raises:

  • ValueError: if the export_fn does not have the required signature

© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/contrib/learn/ExportStrategy

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部