parent
c12866ab1c
commit
1d1f7dfcbd
@ -812,8 +812,8 @@ genrule(
|
||||
}),
|
||||
outs = ["__init__.py"],
|
||||
cmd = select({
|
||||
"api_version_2": "cp $(@D)/_api/v2/v2.py $(OUTS) && sed -i'.original' 's:from . import:from . _api.v2 import:g' $(OUTS)",
|
||||
"//conditions:default": "cp $(@D)/_api/v1/v1.py $(OUTS) && sed -i'.original' 's:from . import:from ._api.v1 import:g' $(OUTS)",
|
||||
"api_version_2": "cp $(@D)/_api/v2/v2.py $(OUTS)",
|
||||
"//conditions:default": "cp $(@D)/_api/v1/v1.py $(OUTS)",
|
||||
}),
|
||||
)
|
||||
|
||||
|
@ -78,7 +78,7 @@ except ImportError:
|
||||
pass
|
||||
|
||||
try:
|
||||
from .python.keras.api._v2 import keras
|
||||
from tensorflow.python.keras.api._v2 import keras
|
||||
_current_module.__path__ = (
|
||||
[_module_util.get_parent_dir(keras)] + _current_module.__path__)
|
||||
setattr(_current_module, "keras", keras)
|
||||
|
@ -69,7 +69,7 @@ except ImportError:
|
||||
pass
|
||||
|
||||
try:
|
||||
from .python.keras.api._v1 import keras
|
||||
from tensorflow.python.keras.api._v1 import keras
|
||||
_current_module.__path__ = (
|
||||
[_module_util.get_parent_dir(keras)] + _current_module.__path__)
|
||||
setattr(_current_module, "keras", keras)
|
||||
|
@ -195,7 +195,8 @@ class _ModuleInitCodeBuilder(object):
|
||||
dest_module_name=parent_module,
|
||||
dest_name=module_split[submodule_index])
|
||||
else:
|
||||
import_from = '.'
|
||||
if submodule_index > 0:
|
||||
import_from += '.' + '.'.join(module_split[:submodule_index])
|
||||
self.add_import(
|
||||
symbol=None,
|
||||
source_module_name=import_from,
|
||||
|
@ -23,7 +23,6 @@ import pkgutil
|
||||
|
||||
import tensorflow as tf
|
||||
|
||||
from tensorflow.python import tf2
|
||||
from tensorflow.python.platform import test
|
||||
|
||||
|
||||
@ -51,18 +50,6 @@ class ModuleTest(test.TestCase):
|
||||
def testName(self):
|
||||
self.assertEqual('tensorflow', tf.__name__)
|
||||
|
||||
def testBuiltInName(self):
|
||||
# range is a built-in name in Python. Just checking that
|
||||
# tf.range works fine.
|
||||
if tf2.enabled():
|
||||
self.assertEqual(
|
||||
'tf.Tensor([1 2 3 4 5 6 7 8 9], shape=(9,), dtype=int32)',
|
||||
str(tf.range(1, 10)))
|
||||
else:
|
||||
self.assertEqual(
|
||||
'Tensor("range:0", shape=(9,), dtype=int32)',
|
||||
str(tf.range(1, 10)))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
test.main()
|
||||
|
Loading…
Reference in New Issue
Block a user