Save an Estimator
Save an estimator (alongside its weights) to the directory
# S3 method for tf_estimator export_savedmodel(object, export_dir_base, serving_input_receiver_fn = NULL, assets_extra = NULL, as_text = FALSE, checkpoint_path = NULL, overwrite = TRUE, versioned = !overwrite, ...)
A TensorFlow estimator.
A string containing a directory in which to export the SavedModel.
A function that takes no argument and
A dict specifying how to populate the assets.extra
directory within the exported SavedModel, or
whether to write the SavedModel proto in text format.
The checkpoint path to export. If
Should the model be exported under a versioned subdirectory?
Optional arguments passed on to the estimator's
The path to the exported directory, as a string.
This method builds a new graph by first calling the serving_input_receiver_fn
to obtain feature
Tensors, and then calling this
Estimator's model_fn to
generate the model graph based on those features. It restores the given
checkpoint (or, lacking that, the most recent checkpoint) into this graph in
a fresh session. Finally it creates a timestamped export directory below the
given export_dir_base, and writes a
SavedModel into it containing a single
MetaGraphDef saved from this session. The exported
SignatureDef for each element of the export_outputs dict
returned from the model_fn, named using the same keys. One of these keys is
always signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY, indicating
which signature will be served when a serving request does not specify one.
For each signature, the outputs are provided by the corresponding
ExportOutputs, and the inputs are always the input receivers provided by
the serving_input_receiver_fn. Extra assets may be written into the
SavedModel via the extra_assets argument. This should be a dict, where each
key gives a 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
ValueError: if no serving_input_receiver_fn is provided, no export_outputs are provided, or no checkpoint can be found.