Fixing builds after removing module wrapper in 2.0.
This commit is contained in:
parent
0a702eb670
commit
0733efc770
@ -125,25 +125,6 @@ if _running_from_pip_package():
|
||||
if _fi.file_exists(plugin_dir):
|
||||
_ll.load_library(plugin_dir)
|
||||
|
||||
# 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
|
||||
# resolution to succeed.
|
||||
# pylint: disable=undefined-variable
|
||||
try:
|
||||
del python
|
||||
except NameError:
|
||||
pass
|
||||
try:
|
||||
del core
|
||||
except NameError:
|
||||
pass
|
||||
try:
|
||||
del compiler
|
||||
except NameError:
|
||||
pass
|
||||
# pylint: enable=undefined-variable
|
||||
|
||||
# Add module aliases
|
||||
if hasattr(_current_module, 'keras'):
|
||||
losses = keras.losses
|
||||
|
@ -314,7 +314,7 @@ class ApiCompatibilityTest(test.TestCase):
|
||||
visitor = python_object_to_proto_visitor.PythonObjectToProtoVisitor()
|
||||
|
||||
public_api_visitor = public_api.PublicAPIVisitor(visitor)
|
||||
public_api_visitor.private_map['tf'] = ['contrib']
|
||||
public_api_visitor.private_map['tf'].append('contrib')
|
||||
if api_version == 2:
|
||||
public_api_visitor.private_map['tf'].append('enable_v2_behavior')
|
||||
|
||||
|
@ -40,6 +40,11 @@ class PublicAPIVisitor(object):
|
||||
|
||||
# Modules/classes we want to suppress entirely.
|
||||
self._private_map = {
|
||||
'tf': [
|
||||
'compiler',
|
||||
'core',
|
||||
'python',
|
||||
],
|
||||
# Some implementations have this internal module that we shouldn't
|
||||
# expose.
|
||||
'tf.flags': ['cpp_flags'],
|
||||
|
@ -97,4 +97,39 @@ for _m in _top_level_modules:
|
||||
# We still need all the names that are toplevel on tensorflow_core
|
||||
from tensorflow_core import *
|
||||
|
||||
# These should not be visible in the main tf module.
|
||||
try:
|
||||
del core
|
||||
except NameError:
|
||||
pass
|
||||
|
||||
try:
|
||||
del python
|
||||
except NameError:
|
||||
pass
|
||||
|
||||
try:
|
||||
del compiler
|
||||
except NameError:
|
||||
pass
|
||||
|
||||
try:
|
||||
del tools
|
||||
except NameError:
|
||||
pass
|
||||
|
||||
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"]
|
||||
# Also import module aliases
|
||||
try:
|
||||
from tensorflow_core import losses, metrics, initializers, optimizers
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
# LINT.ThenChange(//tensorflow/virtual_root_template_v1.__init__.py.oss)
|
||||
|
Loading…
Reference in New Issue
Block a user