message: Fix how keras's model_to_estimator function is exported.
  Fix issue if estimator is not present when API files are generated
  but installed later.
diff: @@ -24,23 +24,54 @@ from tensorflow.python.util.tf_export import tf_export
  # As long as you depend //third_party/py/tensorflow:tensorflow target
  # everything will work as normal.
  -try:
  - from tensorflow.python.estimator import keras as keras_lib # pylint: disable=g-import-not-at-top
  - model_to_estimator = tf_export('keras.estimator.model_to_estimator')(
  - keras_lib.model_to_estimator)
  -except Exception: # pylint: disable=broad-except
  - # pylint: disable=unused-argument
  - def stub_model_to_estimator(keras_model=None,
  +# LINT.IfChange
  +@tf_export('keras.estimator.model_to_estimator')
  +def model_to_estimator(
  + keras_model=None,
  keras_model_path=None,
  custom_objects=None,
  model_dir=None,
  config=None):
  + """Constructs an `Estimator` instance from given keras model.
  +
  + For usage example, please see:
  + [Creating estimators from Keras
  + Models](https://tensorflow.org/guide/estimators#model_to_estimator).
  +
  + Args:
  + keras_model: A compiled Keras model object. This argument is mutually
  + exclusive with `keras_model_path`.
  + keras_model_path: Path to a compiled Keras model saved on disk, in HDF5
  + format, which can be generated with the `save()` method of a Keras model.
  + This argument is mutually exclusive with `keras_model`.
  + custom_objects: Dictionary for custom objects.
  + model_dir: Directory to save `Estimator` model parameters, graph, summary
  + files for TensorBoard, etc.
  + config: `RunConfig` to config `Estimator`.
  +
  + 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.
  + """
  + try:
  + from tensorflow_estimator.python.estimator import keras as keras_lib # pylint: disable=g-import-not-at-top
  + except ImportError:
  raise NotImplementedError(
  'tf.keras.estimator.model_to_estimator function not available in your '
  'installation.')
  - # pylint: enable=unused-argument
  + keras_lib.model_to_estimator(
  + keras_model=keras_model,
  + keras_model_path=keras_model_path,
  + custom_objects=custom_objects,
  + model_dir=model_dir,
  + config=config)
  +
  +# LINT.ThenChange(//third_party/tensorflow_estimator/python/estimator/keras.py)
  - model_to_estimator = tf_export('keras.estimator.model_to_estimator')(
  - stub_model_to_estimator)
  