From 267263629fd8d612719f61991eb2d2e3cd3b2b01 Mon Sep 17 00:00:00 2001 From: Tamara Norman Date: Mon, 14 Jan 2019 02:42:51 -0800 Subject: [PATCH] Change so that tf.random_poisson is renamed to the v2 API instead of to compat PiperOrigin-RevId: 229150058 --- tensorflow/tools/compatibility/renames_v2.py | 1 - tensorflow/tools/compatibility/tf_upgrade_v2.py | 2 ++ tensorflow/tools/compatibility/tf_upgrade_v2_test.py | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tensorflow/tools/compatibility/renames_v2.py b/tensorflow/tools/compatibility/renames_v2.py index b757699f636..f143a260b92 100644 --- a/tensorflow/tools/compatibility/renames_v2.py +++ b/tensorflow/tools/compatibility/renames_v2.py @@ -478,7 +478,6 @@ renames = { 'tf.random_crop': 'tf.image.random_crop', 'tf.random_gamma': 'tf.random.gamma', 'tf.random_normal': 'tf.random.normal', - 'tf.random_poisson': 'tf.compat.v1.random_poisson', 'tf.random_shuffle': 'tf.random.shuffle', 'tf.random_uniform': 'tf.random.uniform', 'tf.read_file': 'tf.io.read_file', diff --git a/tensorflow/tools/compatibility/tf_upgrade_v2.py b/tensorflow/tools/compatibility/tf_upgrade_v2.py index 2c56cbf36bd..994d7f9b7e8 100644 --- a/tensorflow/tools/compatibility/tf_upgrade_v2.py +++ b/tensorflow/tools/compatibility/tf_upgrade_v2.py @@ -601,6 +601,8 @@ class TFAPIChangeSpec(ast_edits.APIChangeSpec): "tf.compat.v1.initializers.truncated_normal", "tf.image.resize_images": "tf.image.resize", + "tf.random_poisson": + "tf.random.poisson", } # pylint: enable=line-too-long diff --git a/tensorflow/tools/compatibility/tf_upgrade_v2_test.py b/tensorflow/tools/compatibility/tf_upgrade_v2_test.py index 0dde5045aae..caf63416d84 100644 --- a/tensorflow/tools/compatibility/tf_upgrade_v2_test.py +++ b/tensorflow/tools/compatibility/tf_upgrade_v2_test.py @@ -539,6 +539,15 @@ bazel-bin/tensorflow/tools/compatibility/update/generate_v2_reorders_map ) self.assertEqual(new_text, expected_text) + def testRandomPoissonConversion(self): + text1 = "tf.random_poisson(lam, shape, dtype)" + text2 = "tf.random.poisson(lam, shape, dtype)" + expected_text = "tf.random.poisson(lam=lam, shape=shape, dtype=dtype)" + _, unused_report, unused_errors, new_text1 = self._upgrade(text1) + self.assertEqual(new_text1, expected_text) + _, unused_report, unused_errors, new_text2 = self._upgrade(text2) + self.assertEqual(new_text2, expected_text) + def testConvolutionOpUpdate(self): text = ( "tf.nn.convolution(input, filter, padding, strides, dilation_rate, "