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
ea646b04
Commit
ea646b04
authored
Jul 22, 2020
by
A. Unique TensorFlower
Browse files
Internal change
PiperOrigin-RevId: 322707701
parent
7fcd7cba
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
orbit/standard_runner.py
orbit/standard_runner.py
+33
-0
No files found.
orbit/standard_runner.py
View file @
ea646b04
...
...
@@ -17,11 +17,33 @@
import
abc
from
typing
import
Any
,
Dict
,
Optional
,
Text
import
dataclasses
from
orbit
import
runner
from
orbit
import
utils
import
tensorflow
as
tf
@
dataclasses
.
dataclass
(
frozen
=
True
)
class
TrainerOverrides
:
"""Advanced overrides for Orbit trainers.
Attributes:
use_tf_while_loop: A boolean indicates whether to wrap the train step with
a `tf.while_loop`.
use_tf_function: A boolean indicates whether a `tf.function` will be used.
If False, training will run on pure eager mode.
use_tpu_summary_optimization: A boolean indicates whether to enable the
performance optimization for summaries in TPUs. In TPUs, writing
summaries with outside compilation inside train step is slow. If True,
it creates two `tf.function` with two XLA programs: one with summaries
and one without, and run the program with summaries (slow one) only if
necessary.
"""
use_tf_while_loop
:
bool
=
True
use_tf_function
:
bool
=
True
use_tpu_summary_optimization
:
bool
=
False
class
StandardTrainer
(
runner
.
AbstractTrainer
,
metaclass
=
abc
.
ABCMeta
):
"""Implements the standard functionality of AbstractTrainer APIs."""
...
...
@@ -139,6 +161,17 @@ class StandardTrainer(runner.AbstractTrainer, metaclass=abc.ABCMeta):
self
.
_train_iter
=
None
@
dataclasses
.
dataclass
(
frozen
=
True
)
class
EvaluatorOverrides
:
"""Advanced overrides for Orbit evaluators.
Attributes:
use_tf_function: A boolean indicates whether a `tf.function` will be used.
If False, training will run on pure eager mode.
"""
use_tf_function
:
bool
=
False
class
StandardEvaluator
(
runner
.
AbstractEvaluator
,
metaclass
=
abc
.
ABCMeta
):
"""Implements the standard functionality of AbstractEvaluator APIs."""
...
...
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