Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
e334f3e2
"vscode:/vscode.git/clone" did not exist on "999306e161c3ed5c83840825277b7c2333ec49eb"
Unverified
Commit
e334f3e2
authored
Feb 13, 2019
by
Toby Boyd
Committed by
GitHub
Feb 13, 2019
Browse files
Do not toggle eager if tf 2.0 is used. (#6188)
parent
79b57a3f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
2 deletions
+11
-2
official/resnet/keras/keras_cifar_main.py
official/resnet/keras/keras_cifar_main.py
+3
-1
official/resnet/keras/keras_common.py
official/resnet/keras/keras_common.py
+5
-0
official/resnet/keras/keras_imagenet_main.py
official/resnet/keras/keras_imagenet_main.py
+3
-1
No files found.
official/resnet/keras/keras_cifar_main.py
View file @
e334f3e2
...
...
@@ -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
)
...
...
official/resnet/keras/keras_common.py
View file @
e334f3e2
...
...
@@ -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
()
...
...
official/resnet/keras/keras_imagenet_main.py
View file @
e334f3e2
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment