Skip to content

Commit

Permalink
Avoid tf deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiltsov-max committed Feb 17, 2020
1 parent 06529b9 commit 18308f0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion datumaro/datumaro/util/tf_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 18308f0

Please sign in to comment.