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
91c681af
Commit
91c681af
authored
Feb 13, 2020
by
Haitang Hu
Committed by
A. Unique TensorFlower
Feb 13, 2020
Browse files
Revert log passing change since it might hurt performance.
PiperOrigin-RevId: 294922828
parent
e8140fa9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
official/modeling/model_training_utils.py
official/modeling/model_training_utils.py
+4
-4
No files found.
official/modeling/model_training_utils.py
View file @
91c681af
...
@@ -329,12 +329,12 @@ def run_customized_training_loop(
...
@@ -329,12 +329,12 @@ def run_customized_training_loop(
for
callback
in
custom_callbacks
:
for
callback
in
custom_callbacks
:
callback
.
on_batch_begin
(
batch
)
callback
.
on_batch_begin
(
batch
)
def
_run_callbacks_on_batch_end
(
batch
,
logs
):
def
_run_callbacks_on_batch_end
(
batch
):
"""Runs custom callbacks at the end of every step."""
"""Runs custom callbacks at the end of every step."""
if
not
custom_callbacks
:
if
not
custom_callbacks
:
return
return
for
callback
in
custom_callbacks
:
for
callback
in
custom_callbacks
:
callback
.
on_batch_end
(
batch
,
logs
)
callback
.
on_batch_end
(
batch
)
# Training loop starts here.
# Training loop starts here.
checkpoint
=
tf
.
train
.
Checkpoint
(
model
=
model
,
optimizer
=
optimizer
)
checkpoint
=
tf
.
train
.
Checkpoint
(
model
=
model
,
optimizer
=
optimizer
)
...
@@ -371,10 +371,10 @@ def run_customized_training_loop(
...
@@ -371,10 +371,10 @@ def run_customized_training_loop(
# Converts steps to a Tensor to avoid tf.function retracing.
# Converts steps to a Tensor to avoid tf.function retracing.
train_steps
(
train_iterator
,
train_steps
(
train_iterator
,
tf
.
convert_to_tensor
(
steps
,
dtype
=
tf
.
int32
))
tf
.
convert_to_tensor
(
steps
,
dtype
=
tf
.
int32
))
train_loss
=
_float_metric_value
(
train_loss_metric
)
_run_callbacks_on_batch_end
(
current_step
)
_run_callbacks_on_batch_end
(
current_step
,
{
'loss'
:
train_loss
})
current_step
+=
steps
current_step
+=
steps
train_loss
=
_float_metric_value
(
train_loss_metric
)
# Updates training logging.
# Updates training logging.
training_status
=
'Train Step: %d/%d / loss = %s'
%
(
training_status
=
'Train Step: %d/%d / loss = %s'
%
(
current_step
,
total_training_steps
,
train_loss
)
current_step
,
total_training_steps
,
train_loss
)
...
...
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