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
50efd367
Commit
50efd367
authored
Nov 20, 2020
by
Reed Wanderman-Milne
Committed by
A. Unique TensorFlower
Nov 20, 2020
Browse files
Internal change
PiperOrigin-RevId: 343529801
parent
cc370af9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
official/vision/image_classification/classifier_trainer.py
official/vision/image_classification/classifier_trainer.py
+5
-1
official/vision/image_classification/classifier_trainer_util_test.py
...sion/image_classification/classifier_trainer_util_test.py
+1
-2
No files found.
official/vision/image_classification/classifier_trainer.py
View file @
50efd367
...
...
@@ -228,7 +228,7 @@ def initialize(params: base_configs.ExperimentConfig,
"""Initializes backend related initializations."""
keras_utils
.
set_session_config
(
enable_xla
=
params
.
runtime
.
enable_xla
)
performance
.
set_mixed_precision_policy
(
dataset_builder
.
dtype
,
get_loss_scale
(
params
)
)
use_experimental_api
=
False
)
if
tf
.
config
.
list_physical_devices
(
'GPU'
):
data_format
=
'channels_first'
else
:
...
...
@@ -338,6 +338,10 @@ def train_and_eval(
base_learning_rate
=
learning_rate
,
params
=
params
.
model
.
optimizer
.
as_dict
(),
model
=
model
)
optimizer
=
performance
.
configure_optimizer
(
optimizer
,
use_float16
=
train_builder
.
dtype
==
'float16'
,
loss_scale
=
get_loss_scale
(
params
))
metrics_map
=
_get_metrics
(
one_hot
)
metrics
=
[
metrics_map
[
metric
]
for
metric
in
params
.
train
.
metrics
]
...
...
official/vision/image_classification/classifier_trainer_util_test.py
View file @
50efd367
...
...
@@ -121,8 +121,7 @@ class UtilTests(parameterized.TestCase, tf.test.TestCase):
def
test_resume_from_checkpoint
(
self
):
"""Tests functionality for resuming from checkpoint."""
# Set the keras policy
policy
=
tf
.
keras
.
mixed_precision
.
experimental
.
Policy
(
'mixed_bfloat16'
)
tf
.
keras
.
mixed_precision
.
experimental
.
set_policy
(
policy
)
tf
.
keras
.
mixed_precision
.
set_global_policy
(
'mixed_bfloat16'
)
# Get the model, datasets, and compile it.
model
=
get_trivial_model
(
10
)
...
...
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