From 501cf726cbee2ee13efef43884a6552ca211979d Mon Sep 17 00:00:00 2001 From: Michael Case Date: Thu, 7 Jun 2018 12:05:24 -0700 Subject: Internal Change. PiperOrigin-RevId: 199673803 --- tensorflow/api_template.__init__.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'tensorflow/api_template.__init__.py') 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 -- cgit v1.2.3