Remove pywrap_tensorflow from compat.v1.

PiperOrigin-RevId: 242552670
This commit is contained in:
Anna R 2019-04-08 15:38:40 -07:00 committed by TensorFlower Gardener
parent 6c71cb2d20
commit a9bac8c984
4 changed files with 18 additions and 6 deletions

View File

@ -21,7 +21,6 @@ from __future__ import print_function as _print_function
import os as _os import os as _os
# pylint: disable=g-bad-import-order # pylint: disable=g-bad-import-order
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
# API IMPORTS PLACEHOLDER # API IMPORTS PLACEHOLDER

View File

@ -373,8 +373,10 @@ class ApiCompatibilityTest(test.TestCase):
golden_file_pattern = os.path.join( golden_file_pattern = os.path.join(
resource_loader.get_root_dir_with_all_resources(), resource_loader.get_root_dir_with_all_resources(),
_KeyToFilePath('*', api_version)) _KeyToFilePath('*', api_version))
self._checkBackwardsCompatibility(tf.compat.v1, golden_file_pattern, self._checkBackwardsCompatibility(
api_version) tf.compat.v1, golden_file_pattern, api_version,
additional_private_map={'tf': ['pywrap_tensorflow']},
omit_golden_symbols_map={'tensorflow': ['pywrap_tensorflow']})
def testAPIBackwardsCompatibilityV2(self): def testAPIBackwardsCompatibilityV2(self):
api_version = 2 api_version = 2

View File

@ -672,8 +672,6 @@ class TFAPIChangeSpec(ast_edits.APIChangeSpec):
"tf.strings.reduce_join", "tf.strings.reduce_join",
"tf.load_file_system_library": "tf.load_file_system_library":
"tf.load_library", "tf.load_library",
"tf.pywrap_tensorflow":
"tf.compat.v1.pywrap_tensorflow",
"tf.bincount": "tf.bincount":
"tf.math.bincount", "tf.math.bincount",
"tf.confusion_matrix": "tf.confusion_matrix":
@ -1423,7 +1421,13 @@ class TFAPIChangeSpec(ast_edits.APIChangeSpec):
"<function name> returns ResourceVariables by default in 2.0, " "<function name> returns ResourceVariables by default in 2.0, "
"which have well-defined semantics and are stricter about shapes. " "which have well-defined semantics and are stricter about shapes. "
"You can disable this behavior by passing use_resource=False, or " "You can disable this behavior by passing use_resource=False, or "
"by calling tf.compat.v1.disable_resource_variables().") "by calling tf.compat.v1.disable_resource_variables()."),
"tf.pywrap_tensorflow":
(ast_edits.ERROR,
"<function name> cannot be converted automatically. "
"`tf.pywrap_tensorflow` will not be distributed with "
"TensorFlow 2.0, please consider an alternative in public "
"TensorFlow APIs.")
} }
# Warnings that are emitted only if a specific arg is found. # Warnings that are emitted only if a specific arg is found.

View File

@ -1572,6 +1572,13 @@ def _log_prob(self, x):
_, _, _, new_text = self._upgrade(text) _, _, _, new_text = self._upgrade(text)
self.assertEqual(new_text, expected_text) self.assertEqual(new_text, expected_text)
def testPywrapTensorflowWarning(self):
text = "tf.pywrap_tensorflow.foo()"
expected = "tf.pywrap_tensorflow.foo()"
_, _, errors, new_text = self._upgrade(text)
self.assertEqual(expected, new_text)
self.assertIn("`tf.pywrap_tensorflow` will not be distributed", errors[0])
class TestUpgradeFiles(test_util.TensorFlowTestCase): class TestUpgradeFiles(test_util.TensorFlowTestCase):