From 18308f01f4ca2e371bf4b29fd0fa281368e610ae Mon Sep 17 00:00:00 2001 From: Zhiltsov Max Date: Mon, 17 Feb 2020 18:05:47 +0300 Subject: [PATCH] Avoid tf deprecation warning --- datumaro/datumaro/util/tf_util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/datumaro/datumaro/util/tf_util.py b/datumaro/datumaro/util/tf_util.py index 0d939a95ce39..beaa4fc74e4c 100644 --- a/datumaro/datumaro/util/tf_util.py +++ b/datumaro/datumaro/util/tf_util.py @@ -26,12 +26,15 @@ def import_tf(): pass # Enable eager execution in early versions to unlock dataset operations + eager_enabled = False try: tf.compat.v1.enable_eager_execution() + eager_enabled = True except AttributeError: pass try: - tf.enable_eager_execution() + if not eager_enabled: + tf.enable_eager_execution() except AttributeError: pass