W3cubDocs

/TensorFlow Python

tf.keras.estimator.model_to_estimator

tf.keras.estimator.model_to_estimator(
    keras_model=None,
    keras_model_path=None,
    custom_objects=None,
    model_dir=None,
    config=None
)

Defined in tensorflow/python/keras/_impl/keras/estimator.py.

Constructs an Estimator instance from given keras model.

For usage example, please see creating_estimators_from_keras_models.

Args:

  • keras_model: Keras model in memory.
  • keras_model_path: Directory to a keras model on disk.
  • custom_objects: Dictionary for custom objects.
  • model_dir: Directory to save Estimator model parameters, graph and etc.
  • config: Configuration object.

Returns:

An Estimator from given keras model.

Raises:

  • ValueError: if neither keras_model nor keras_model_path was given.
  • ValueError: if both keras_model and keras_model_path was given.
  • ValueError: if the keras_model_path is a GCS URI.
  • ValueError: if keras_model has not been compiled.

© 2018 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/keras/estimator/model_to_estimator