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
888773cf
Commit
888773cf
authored
Dec 03, 2021
by
Dinghua Li
Committed by
A. Unique TensorFlower
Dec 03, 2021
Browse files
Log a message when an iterator is exhausted during a Orbit training/evaluation.
PiperOrigin-RevId: 413973623
parent
dae3ba89
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
orbit/utils/loop_fns.py
orbit/utils/loop_fns.py
+3
-1
No files found.
orbit/utils/loop_fns.py
View file @
888773cf
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
"""Utilities for creating loop functions."""
"""Utilities for creating loop functions."""
from
absl
import
logging
from
orbit.utils
import
tpu_summaries
from
orbit.utils
import
tpu_summaries
import
tensorflow
as
tf
import
tensorflow
as
tf
...
@@ -65,8 +66,8 @@ def create_loop_fn(step_fn):
...
@@ -65,8 +66,8 @@ def create_loop_fn(step_fn):
The final state returned by `reduce_fn`, or `None` if `state` and
The final state returned by `reduce_fn`, or `None` if `state` and
`reduce_fn` are not provided.
`reduce_fn` are not provided.
"""
"""
try
:
step
=
0
step
=
0
try
:
# To make sure the OutOfRangeError exception can be handled well under
# To make sure the OutOfRangeError exception can be handled well under
# async remote eager, we need to wrap the loop body in `async_scope`.
# async remote eager, we need to wrap the loop body in `async_scope`.
with
tf
.
experimental
.
async_scope
():
with
tf
.
experimental
.
async_scope
():
...
@@ -77,6 +78,7 @@ def create_loop_fn(step_fn):
...
@@ -77,6 +78,7 @@ def create_loop_fn(step_fn):
step
+=
1
step
+=
1
return
state
return
state
except
(
StopIteration
,
tf
.
errors
.
OutOfRangeError
):
except
(
StopIteration
,
tf
.
errors
.
OutOfRangeError
):
logging
.
info
(
"The dataset iterator is exhausted after %d steps."
,
step
)
tf
.
experimental
.
async_clear_error
()
tf
.
experimental
.
async_clear_error
()
return
state
return
state
...
...
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