Internal change

PiperOrigin-RevId: 253284909
This commit is contained in:
Mihai Maruseac 2019-06-14 13:24:20 -07:00 committed by TensorFlower Gardener
parent eed9bfdeb0
commit 119de52436
3 changed files with 10 additions and 6 deletions

View File

@ -225,8 +225,7 @@ __all__.extend([_s for _s in _names_with_underscore])
if self._api_version == 1: # Add 1.* deprecations. if self._api_version == 1: # Add 1.* deprecations.
for dest_module, _ in self._module_imports.items(): for dest_module, _ in self._module_imports.items():
if (dest_module and if not dest_module.startswith(_COMPAT_MODULE_PREFIX):
not dest_module.startswith(_COMPAT_MODULE_PREFIX)):
footer_text_map[dest_module] = _DEPRECATION_FOOTER % ( footer_text_map[dest_module] = _DEPRECATION_FOOTER % (
dest_module) dest_module)

View File

@ -1,4 +1,3 @@
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
@ -29,7 +28,7 @@ from tensorflow.python.platform import tf_logging as logging
class DeprecationTest(test.TestCase): class DeprecationTest(test.TestCase):
@test.mock.patch.object(logging, "warning", autospec=True) @test.mock.patch.object(logging, "warning", autospec=True)
def DISABLED_testDeprecatedFunction(self, mock_warning): def testDeprecatedFunction(self, mock_warning):
self.assertEqual(0, mock_warning.call_count) self.assertEqual(0, mock_warning.call_count)
tf.compat.v1.initializers.tables_initializer() tf.compat.v1.initializers.tables_initializer()
self.assertEqual(0, mock_warning.call_count) self.assertEqual(0, mock_warning.call_count)
@ -70,7 +69,7 @@ class DeprecationTest(test.TestCase):
self.assertEqual(1, mock_warning.call_count) self.assertEqual(1, mock_warning.call_count)
@test.mock.patch.object(logging, "warning", autospec=True) @test.mock.patch.object(logging, "warning", autospec=True)
def DISABLED_testDeprecatedFunctionEndpoint(self, mock_warning): def testDeprecatedFunctionEndpoint(self, mock_warning):
array = tf.IndexedSlices( array = tf.IndexedSlices(
tf.compat.v1.convert_to_tensor(np.array([1, 2])), tf.compat.v1.convert_to_tensor(np.array([1, 2])),
tf.compat.v1.convert_to_tensor(np.array([0, 2]))) tf.compat.v1.convert_to_tensor(np.array([0, 2])))
@ -94,7 +93,7 @@ class DeprecationTest(test.TestCase):
self.assertEqual(1, mock_warning.call_count) self.assertEqual(1, mock_warning.call_count)
@test.mock.patch.object(logging, "warning", autospec=True) @test.mock.patch.object(logging, "warning", autospec=True)
def DISABLED_testDeprecatedClassEndpoint(self, mock_warning): def testDeprecatedClassEndpoint(self, mock_warning):
self.assertEqual(0, mock_warning.call_count) self.assertEqual(0, mock_warning.call_count)
tf.io.VarLenFeature(tf.dtypes.int32) tf.io.VarLenFeature(tf.dtypes.int32)
self.assertEqual(0, mock_warning.call_count) self.assertEqual(0, mock_warning.call_count)

View File

@ -120,4 +120,10 @@ try:
except ImportError as e: except ImportError as e:
pass pass
# In V1 API we need to print deprecation messages
from tensorflow.python.util import deprecation_wrapper as _deprecation
if not isinstance(_sys.modules[__name__], _deprecation.DeprecationWrapper):
_sys.modules[__name__] = _deprecation.DeprecationWrapper(
_sys.modules[__name__], "")
# LINT.ThenChange(//tensorflow/virtual_root_template_v2.__init__.py.oss) # LINT.ThenChange(//tensorflow/virtual_root_template_v2.__init__.py.oss)