From 68f3f95536368046402b720805130b804f3a96dd Mon Sep 17 00:00:00 2001 From: srjindal Date: Tue, 7 Jan 2020 14:41:45 -0800 Subject: [PATCH] Internal change PiperOrigin-RevId: 288575572 --- .../tensorboard_plugin_fairness_indicators/demo.py | 5 +++-- .../tensorboard_plugin_fairness_indicators/plugin_test.py | 5 +++-- .../summary_v2_test.py | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tensorboard_plugin/tensorboard_plugin_fairness_indicators/demo.py b/tensorboard_plugin/tensorboard_plugin_fairness_indicators/demo.py index 138245d2..0c613541 100644 --- a/tensorboard_plugin/tensorboard_plugin_fairness_indicators/demo.py +++ b/tensorboard_plugin/tensorboard_plugin_fairness_indicators/demo.py @@ -22,9 +22,10 @@ from absl import flags from tensorboard_plugin_fairness_indicators import summary_v2 import tensorflow.compat.v1 as tf +import tensorflow.compat.v2 as tf2 -tf.compat.v1.enable_eager_execution() -tf = tf.compat.v2 +tf.enable_eager_execution() +tf = tf2 FLAGS = flags.FLAGS diff --git a/tensorboard_plugin/tensorboard_plugin_fairness_indicators/plugin_test.py b/tensorboard_plugin/tensorboard_plugin_fairness_indicators/plugin_test.py index ff691473..c7bccdab 100644 --- a/tensorboard_plugin/tensorboard_plugin_fairness_indicators/plugin_test.py +++ b/tensorboard_plugin/tensorboard_plugin_fairness_indicators/plugin_test.py @@ -25,6 +25,7 @@ from tensorboard_plugin_fairness_indicators import plugin from tensorboard_plugin_fairness_indicators import summary_v2 import tensorflow.compat.v1 as tf +import tensorflow.compat.v2 as tf2 import tensorflow_model_analysis as tfma from tensorflow_model_analysis.eval_saved_model.example_trainers import linear_classifier from werkzeug import test as werkzeug_test @@ -39,8 +40,8 @@ except ImportError: import mock # pylint: disable=g-import-not-at-top,unused-import -tf.compat.v1.enable_eager_execution() -tf = tf.compat.v2 +tf.enable_eager_execution() +tf = tf2 class PluginTest(tf.test.TestCase): diff --git a/tensorboard_plugin/tensorboard_plugin_fairness_indicators/summary_v2_test.py b/tensorboard_plugin/tensorboard_plugin_fairness_indicators/summary_v2_test.py index 786f109c..39ec29c8 100644 --- a/tensorboard_plugin/tensorboard_plugin_fairness_indicators/summary_v2_test.py +++ b/tensorboard_plugin/tensorboard_plugin_fairness_indicators/summary_v2_test.py @@ -32,7 +32,7 @@ tf2 = None try: - tf.compat.v1.enable_eager_execution() + tf.enable_eager_execution() except AttributeError: # TF 2.0 doesn't have this symbol because eager is the default. pass @@ -49,7 +49,7 @@ def _write_summary(self, eval_result_output_dir): def _get_event(self): event_files = sorted(glob.glob(os.path.join(self.get_temp_dir(), '*'))) self.assertEqual(len(event_files), 1) - events = list(tf.compat.v1.train.summary_iterator(event_files[0])) + events = list(tf.train.summary_iterator(event_files[0])) # Expect a boilerplate event for the file_version, then the summary one. self.assertEqual(len(events), 2) return events[1]