aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/__init__.py
diff options
context:
space:
mode:
authorGravatar Mark Daoust <markdaoust@google.com>2017-04-19 06:15:23 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-04-19 07:29:05 -0700
commit95c5d7e880b8b4d18ba1f3b7cf40d15cd218b3c9 (patch)
tree9ad003a886fe9444fccd2f3183f33a5b345db106 /tensorflow/__init__.py
parent8b6c3c8e8817b64e83ba3a7379935d0ea9232605 (diff)
Generalize LazyLoader for use by ffmpeg
Add __dir__ method so the docs generator doesn't need to do anything special to activate the loading Change: 153583515
Diffstat (limited to 'tensorflow/__init__.py')
-rw-r--r--tensorflow/__init__.py16
1 files changed, 3 insertions, 13 deletions
diff --git a/tensorflow/__init__.py b/tensorflow/__init__.py
index 0bca6f8fb8..083634bd79 100644
--- a/tensorflow/__init__.py
+++ b/tensorflow/__init__.py
@@ -24,19 +24,9 @@ from __future__ import print_function
from tensorflow.python import *
# pylint: enable=wildcard-import
-# Lazily import the `tf.contrib` module. This avoids loading all of the
-# dependencies of `tf.contrib` at `import tensorflow` time.
-class _LazyContribLoader(object):
-
- def __getattr__(self, item):
- global contrib
- # Replace the lazy loader with the imported module itself.
- import importlib # pylint: disable=g-import-not-at-top
- contrib = importlib.import_module('tensorflow.contrib')
- return getattr(contrib, item)
-
-
-contrib = _LazyContribLoader()
+from tensorflow.python.util.lazy_loader import LazyLoader
+contrib = LazyLoader('contrib', globals(), 'tensorflow.contrib')
+del LazyLoader
del absolute_import
del division