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
092def7b
Unverified
Commit
092def7b
authored
Jun 20, 2019
by
Haoyu Zhang
Committed by
GitHub
Jun 20, 2019
Browse files
Fix resnet tests (#7071)
parent
1636acc9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
official/resnet/keras/keras_cifar_test.py
official/resnet/keras/keras_cifar_test.py
+4
-3
official/resnet/keras/keras_imagenet_test.py
official/resnet/keras/keras_imagenet_test.py
+7
-6
No files found.
official/resnet/keras/keras_cifar_test.py
View file @
092def7b
...
@@ -24,6 +24,7 @@ import tensorflow as tf
...
@@ -24,6 +24,7 @@ import tensorflow as tf
from
official.resnet
import
cifar10_main
from
official.resnet
import
cifar10_main
from
official.resnet.keras
import
keras_cifar_main
from
official.resnet.keras
import
keras_cifar_main
from
official.resnet.keras
import
keras_common
from
official.resnet.keras
import
keras_common
from
official.utils.misc
import
keras_utils
from
official.utils.testing
import
integration
from
official.utils.testing
import
integration
# pylint: disable=ungrouped-imports
# pylint: disable=ungrouped-imports
from
tensorflow.python.eager
import
context
from
tensorflow.python.eager
import
context
...
@@ -61,7 +62,7 @@ class KerasCifarTest(googletest.TestCase):
...
@@ -61,7 +62,7 @@ class KerasCifarTest(googletest.TestCase):
def
test_end_to_end_no_dist_strat
(
self
):
def
test_end_to_end_no_dist_strat
(
self
):
"""Test Keras model with 1 GPU, no distribution strategy."""
"""Test Keras model with 1 GPU, no distribution strategy."""
config
=
keras_
common
.
get_config_proto_v1
()
config
=
keras_
utils
.
get_config_proto_v1
()
tf
.
compat
.
v1
.
enable_eager_execution
(
config
=
config
)
tf
.
compat
.
v1
.
enable_eager_execution
(
config
=
config
)
extra_flags
=
[
extra_flags
=
[
...
@@ -95,7 +96,7 @@ class KerasCifarTest(googletest.TestCase):
...
@@ -95,7 +96,7 @@ class KerasCifarTest(googletest.TestCase):
def
test_end_to_end_1_gpu
(
self
):
def
test_end_to_end_1_gpu
(
self
):
"""Test Keras model with 1 GPU."""
"""Test Keras model with 1 GPU."""
config
=
keras_
common
.
get_config_proto_v1
()
config
=
keras_
utils
.
get_config_proto_v1
()
tf
.
compat
.
v1
.
enable_eager_execution
(
config
=
config
)
tf
.
compat
.
v1
.
enable_eager_execution
(
config
=
config
)
if
context
.
num_gpus
()
<
1
:
if
context
.
num_gpus
()
<
1
:
...
@@ -141,7 +142,7 @@ class KerasCifarTest(googletest.TestCase):
...
@@ -141,7 +142,7 @@ class KerasCifarTest(googletest.TestCase):
def
test_end_to_end_2_gpu
(
self
):
def
test_end_to_end_2_gpu
(
self
):
"""Test Keras model with 2 GPUs."""
"""Test Keras model with 2 GPUs."""
config
=
keras_
common
.
get_config_proto_v1
()
config
=
keras_
utils
.
get_config_proto_v1
()
tf
.
compat
.
v1
.
enable_eager_execution
(
config
=
config
)
tf
.
compat
.
v1
.
enable_eager_execution
(
config
=
config
)
if
context
.
num_gpus
()
<
2
:
if
context
.
num_gpus
()
<
2
:
...
...
official/resnet/keras/keras_imagenet_test.py
View file @
092def7b
...
@@ -24,6 +24,7 @@ import tensorflow as tf
...
@@ -24,6 +24,7 @@ import tensorflow as tf
from
official.resnet
import
imagenet_main
from
official.resnet
import
imagenet_main
from
official.resnet.keras
import
keras_common
from
official.resnet.keras
import
keras_common
from
official.resnet.keras
import
keras_imagenet_main
from
official.resnet.keras
import
keras_imagenet_main
from
official.utils.misc
import
keras_utils
from
official.utils.testing
import
integration
from
official.utils.testing
import
integration
# pylint: disable=ungrouped-imports
# pylint: disable=ungrouped-imports
from
tensorflow.python.eager
import
context
from
tensorflow.python.eager
import
context
...
@@ -61,7 +62,7 @@ class KerasImagenetTest(googletest.TestCase):
...
@@ -61,7 +62,7 @@ class KerasImagenetTest(googletest.TestCase):
def
test_end_to_end_no_dist_strat
(
self
):
def
test_end_to_end_no_dist_strat
(
self
):
"""Test Keras model with 1 GPU, no distribution strategy."""
"""Test Keras model with 1 GPU, no distribution strategy."""
config
=
keras_
common
.
get_config_proto_v1
()
config
=
keras_
utils
.
get_config_proto_v1
()
tf
.
compat
.
v1
.
enable_eager_execution
(
config
=
config
)
tf
.
compat
.
v1
.
enable_eager_execution
(
config
=
config
)
extra_flags
=
[
extra_flags
=
[
...
@@ -95,7 +96,7 @@ class KerasImagenetTest(googletest.TestCase):
...
@@ -95,7 +96,7 @@ class KerasImagenetTest(googletest.TestCase):
def
test_end_to_end_1_gpu
(
self
):
def
test_end_to_end_1_gpu
(
self
):
"""Test Keras model with 1 GPU."""
"""Test Keras model with 1 GPU."""
config
=
keras_
common
.
get_config_proto_v1
()
config
=
keras_
utils
.
get_config_proto_v1
()
tf
.
compat
.
v1
.
enable_eager_execution
(
config
=
config
)
tf
.
compat
.
v1
.
enable_eager_execution
(
config
=
config
)
if
context
.
num_gpus
()
<
1
:
if
context
.
num_gpus
()
<
1
:
...
@@ -141,7 +142,7 @@ class KerasImagenetTest(googletest.TestCase):
...
@@ -141,7 +142,7 @@ class KerasImagenetTest(googletest.TestCase):
def
test_end_to_end_2_gpu
(
self
):
def
test_end_to_end_2_gpu
(
self
):
"""Test Keras model with 2 GPUs."""
"""Test Keras model with 2 GPUs."""
config
=
keras_
common
.
get_config_proto_v1
()
config
=
keras_
utils
.
get_config_proto_v1
()
tf
.
compat
.
v1
.
enable_eager_execution
(
config
=
config
)
tf
.
compat
.
v1
.
enable_eager_execution
(
config
=
config
)
if
context
.
num_gpus
()
<
2
:
if
context
.
num_gpus
()
<
2
:
...
@@ -164,7 +165,7 @@ class KerasImagenetTest(googletest.TestCase):
...
@@ -164,7 +165,7 @@ class KerasImagenetTest(googletest.TestCase):
def
test_end_to_end_xla_2_gpu
(
self
):
def
test_end_to_end_xla_2_gpu
(
self
):
"""Test Keras model with XLA and 2 GPUs."""
"""Test Keras model with XLA and 2 GPUs."""
config
=
keras_
common
.
get_config_proto_v1
()
config
=
keras_
utils
.
get_config_proto_v1
()
tf
.
compat
.
v1
.
enable_eager_execution
(
config
=
config
)
tf
.
compat
.
v1
.
enable_eager_execution
(
config
=
config
)
if
context
.
num_gpus
()
<
2
:
if
context
.
num_gpus
()
<
2
:
...
@@ -188,7 +189,7 @@ class KerasImagenetTest(googletest.TestCase):
...
@@ -188,7 +189,7 @@ class KerasImagenetTest(googletest.TestCase):
def
test_end_to_end_2_gpu_fp16
(
self
):
def
test_end_to_end_2_gpu_fp16
(
self
):
"""Test Keras model with 2 GPUs and fp16."""
"""Test Keras model with 2 GPUs and fp16."""
config
=
keras_
common
.
get_config_proto_v1
()
config
=
keras_
utils
.
get_config_proto_v1
()
tf
.
compat
.
v1
.
enable_eager_execution
(
config
=
config
)
tf
.
compat
.
v1
.
enable_eager_execution
(
config
=
config
)
if
context
.
num_gpus
()
<
2
:
if
context
.
num_gpus
()
<
2
:
...
@@ -212,7 +213,7 @@ class KerasImagenetTest(googletest.TestCase):
...
@@ -212,7 +213,7 @@ class KerasImagenetTest(googletest.TestCase):
def
test_end_to_end_xla_2_gpu_fp16
(
self
):
def
test_end_to_end_xla_2_gpu_fp16
(
self
):
"""Test Keras model with XLA, 2 GPUs and fp16."""
"""Test Keras model with XLA, 2 GPUs and fp16."""
config
=
keras_
common
.
get_config_proto_v1
()
config
=
keras_
utils
.
get_config_proto_v1
()
tf
.
compat
.
v1
.
enable_eager_execution
(
config
=
config
)
tf
.
compat
.
v1
.
enable_eager_execution
(
config
=
config
)
if
context
.
num_gpus
()
<
2
:
if
context
.
num_gpus
()
<
2
:
...
...
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