Unverified Commit e334f3e2 authored by Toby Boyd's avatar Toby Boyd Committed by GitHub
Browse files

Do not toggle eager if tf 2.0 is used. (#6188)

parent 79b57a3f
......@@ -97,7 +97,9 @@ def run(flags_obj):
Returns:
Dictionary of training and eval stats.
"""
if flags_obj.enable_eager:
# TODO(tobyboyd): Remove eager flag when tf 1.0 testing ends.
# Eager is default in tf 2.0 and should not be toggled
if flags_obj.enable_eager and not keras_common.is_v2_0():
tf.compat.v1.enable_eager_execution()
dtype = flags_core.get_tf_dtype(flags_obj)
......
......@@ -252,6 +252,11 @@ def get_synth_input_fn(height, width, num_channels, num_classes,
return input_fn
def is_v2_0():
"""Returns true if using tf 2.0."""
return tf.__version__.startswith('2')
def get_strategy_scope(strategy):
if strategy:
strategy_scope = strategy.scope()
......
......@@ -87,7 +87,9 @@ def run(flags_obj):
Raises:
ValueError: If fp16 is passed as it is not currently supported.
"""
if flags_obj.enable_eager:
# TODO(tobyboyd): Remove eager flag when tf 1.0 testing ends.
# Eager is default in tf 2.0 and should not be toggled
if flags_obj.enable_eager and not keras_common.is_v2_0():
tf.compat.v1.enable_eager_execution()
dtype = flags_core.get_tf_dtype(flags_obj)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment