Explicitly assign keras and estimator as attributes.

This is required just to fix a strange side effect of our wrappers for lazy loading, deprecation messages, forwarding and virtual pip which causes failures in

``` console
>>> import tensorflow as tf
>>> tf.keras   # tf.estimator has same error
```

We will need much more time to debug this, but this change seems to be a good way to patch this for now.

PiperOrigin-RevId: 267431746
This commit is contained in:
Mihai Maruseac 2019-09-05 12:48:30 -07:00 committed by TensorFlower Gardener
parent dd54d1fb70
commit 18c2cf989a
2 changed files with 8 additions and 0 deletions

View File

@ -129,4 +129,8 @@ try:
del examples
except NameError:
pass
# Manually patch keras and estimator so tf.keras and tf.estimator work
keras = _sys.modules["tensorflow.keras"]
if not _root_estimator: estimator = _sys.modules["tensorflow.estimator"]
# LINT.ThenChange(//tensorflow/virtual_root_template_v2.__init__.py.oss)

View File

@ -122,4 +122,8 @@ try:
del examples
except NameError:
pass
# Manually patch keras and estimator so tf.keras and tf.estimator work
keras = _sys.modules["tensorflow.keras"]
if not _root_estimator: estimator = _sys.modules["tensorflow.estimator"]
# LINT.ThenChange(//tensorflow/virtual_root_template_v1.__init__.py.oss)