Skip to content

Commit a2da181

Browse files
authored
Avoid tf deprecation warning (#1148)
1 parent 15dc61d commit a2da181

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

datumaro/datumaro/util/tf_util.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,15 @@ def import_tf():
2626
pass
2727

2828
# Enable eager execution in early versions to unlock dataset operations
29+
eager_enabled = False
2930
try:
3031
tf.compat.v1.enable_eager_execution()
32+
eager_enabled = True
3133
except AttributeError:
3234
pass
3335
try:
34-
tf.enable_eager_execution()
36+
if not eager_enabled:
37+
tf.enable_eager_execution()
3538
except AttributeError:
3639
pass
3740

0 commit comments

Comments
 (0)