diff options
author | Michael Case <mikecase@google.com> | 2018-09-21 15:36:17 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-09-21 15:40:27 -0700 |
commit | 47d8a750bc0a9e3165e8fc61d38df3646bf8f278 (patch) | |
tree | 069537b9931f508cc85684675f10b413fe11ad5e /tensorflow/api_template.__init__.py | |
parent | 9655bbd9d67a62b4af399100201918f138316dac (diff) |
Fix "from tensorflow._api.v1 import *".
PiperOrigin-RevId: 214055060
Diffstat (limited to 'tensorflow/api_template.__init__.py')
-rw-r--r-- | tensorflow/api_template.__init__.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tensorflow/api_template.__init__.py b/tensorflow/api_template.__init__.py index 53a72b8443..2de740e145 100644 --- a/tensorflow/api_template.__init__.py +++ b/tensorflow/api_template.__init__.py @@ -14,9 +14,9 @@ # ============================================================================== """Bring in all of the public TensorFlow interface into this module.""" -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function +from __future__ import absolute_import as _absolute_import +from __future__ import division as _division +from __future__ import print_function as _print_function import os as _os @@ -41,6 +41,11 @@ except (ImportError, AttributeError): from tensorflow.python.util.lazy_loader import LazyLoader # pylint: disable=g-import-not-at-top contrib = LazyLoader('contrib', globals(), 'tensorflow.contrib') del LazyLoader +# The templated code that replaces the placeholder above sometimes +# sets the __all__ variable. If it does, we have to be sure to add +# "contrib". +if '__all__' in vars(): + vars()['__all__'].append('contrib') from tensorflow.python.platform import flags # pylint: disable=g-import-not-at-top app.flags = flags # pylint: disable=undefined-variable @@ -51,10 +56,6 @@ _tf_api_dir = _os.path.dirname(_os.path.dirname(app.__file__)) # pylint: disabl if _tf_api_dir not in __path__: __path__.append(_tf_api_dir) -del absolute_import -del division -del print_function - # These symbols appear because we import the python package which # in turn imports from tensorflow.core and tensorflow.python. They # must come from this module. So python adds these symbols for the |