aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/api_template.__init__.py
diff options
context:
space:
mode:
authorGravatar Michael Case <mikecase@google.com>2018-06-07 12:05:24 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-06-07 12:14:50 -0700
commit501cf726cbee2ee13efef43884a6552ca211979d (patch)
tree2a93bae901b9f9d32f5d622e2e4d626668b48b99 /tensorflow/api_template.__init__.py
parent4d0d60a82c52c6c71650db33bf826f03559d91fc (diff)
Internal Change.
PiperOrigin-RevId: 199673803
Diffstat (limited to 'tensorflow/api_template.__init__.py')
-rw-r--r--tensorflow/api_template.__init__.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/tensorflow/api_template.__init__.py b/tensorflow/api_template.__init__.py
index 9b0d7d48af..9662d7b478 100644
--- a/tensorflow/api_template.__init__.py
+++ b/tensorflow/api_template.__init__.py
@@ -22,7 +22,22 @@ from __future__ import print_function
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
# API IMPORTS PLACEHOLDER
-from tensorflow.python.util.lazy_loader import LazyLoader
+try:
+ import os # pylint: disable=g-import-not-at-top
+ # Add `estimator` attribute to allow access to estimator APIs via
+ # "tf.estimator..."
+ from tensorflow.python.estimator.api import estimator # pylint: disable=g-import-not-at-top
+
+ # Add `estimator` to the __path__ to allow "from tensorflow.estimator..."
+ # style imports.
+ from tensorflow.python.estimator import api as estimator_api # pylint: disable=g-import-not-at-top
+ __path__ += [os.path.dirname(estimator_api.__file__)]
+ del estimator_api
+ del os
+except (ImportError, AttributeError):
+ print('tf.estimator package not installed.')
+
+from tensorflow.python.util.lazy_loader import LazyLoader # pylint: disable=g-import-not-at-top
contrib = LazyLoader('contrib', globals(), 'tensorflow.contrib')
del LazyLoader