Type RNNEstimator
Namespace tensorflow_estimator.contrib.estimator
Parent Estimator
Interfaces IRNNEstimator
Methods
- experimental_export_all_saved_models
- experimental_export_all_saved_models_dyn
- export_saved_model
- export_saved_model_dyn
- NewDyn
- train
- train
- train
Properties
Public instance methods
object experimental_export_all_saved_models(object export_dir_base, object input_receiver_fn_map, object assets_extra, bool as_text, object checkpoint_path)
object experimental_export_all_saved_models_dyn(object export_dir_base, object input_receiver_fn_map, object assets_extra, ImplicitContainer<T> as_text, object checkpoint_path)
object export_saved_model(object export_dir_base, PythonFunctionContainer serving_input_receiver_fn, object assets_extra, bool as_text, object checkpoint_path, ImplicitContainer<T> experimental_mode)
object export_saved_model_dyn(object export_dir_base, object serving_input_receiver_fn, object assets_extra, ImplicitContainer<T> as_text, object checkpoint_path, ImplicitContainer<T> experimental_mode)
Exports a
tf.keras.Model
as a Tensorflow SavedModel. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Please use `model.save(..., save_format="tf")` or `tf.keras.models.save_model(..., save_format="tf")`. Note that at this time, subclassed models can only be saved using
`serving_only=True`. The exported `SavedModel` is a standalone serialization of Tensorflow objects,
and is supported by TF language APIs and the Tensorflow Serving system.
To load the model, use the function
tf.keras.experimental.load_from_saved_model
. The `SavedModel` contains: 1. a checkpoint containing the model weights.
2. a `SavedModel` proto containing the Tensorflow backend graph. Separate
graphs are saved for prediction (serving), train, and evaluation. If
the model has not been compiled, then only the graph computing predictions
will be exported.
3. the model's json config. If the model is subclassed, this will only be
included if the model's `get_config()` method is overwritten. Example:
Parameters
-
object
export_dir_base -
object
serving_input_receiver_fn -
object
assets_extra -
ImplicitContainer<T>
as_text - bool, `False` by default. Whether to write the `SavedModel` proto in text format. Currently unavailable in serving-only mode.
-
object
checkpoint_path -
ImplicitContainer<T>
experimental_mode
Show Example
import tensorflow as tf # Create a tf.keras model. model = tf.keras.Sequential() model.add(tf.keras.layers.Dense(1, input_shape=[10])) model.summary() # Save the tf.keras model in the SavedModel format. path = '/tmp/simple_keras_model' tf.keras.experimental.export_saved_model(model, path) # Load the saved keras model back. new_model = tf.keras.experimental.load_from_saved_model(path) new_model.summary()