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
a4ae812e
Commit
a4ae812e
authored
Sep 01, 2022
by
Chen Qian
Committed by
A. Unique TensorFlower
Sep 01, 2022
Browse files
Internal change
PiperOrigin-RevId: 471682920
parent
56453cd5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
official/legacy/image_classification/resnet/common.py
official/legacy/image_classification/resnet/common.py
+6
-2
No files found.
official/legacy/image_classification/resnet/common.py
View file @
a4ae812e
...
@@ -106,9 +106,13 @@ class PiecewiseConstantDecayWithWarmup(
...
@@ -106,9 +106,13 @@ class PiecewiseConstantDecayWithWarmup(
}
}
def
get_optimizer
(
learning_rate
=
0.1
):
def
get_optimizer
(
learning_rate
=
0.1
,
use_legacy_optimizer
=
True
):
"""Returns optimizer to use."""
"""Returns optimizer to use."""
# The learning_rate is overwritten at the beginning of each step by callback.
# The learning_rate is overwritten at the beginning of each step by callback.
if
use_legacy_optimizer
:
return
tf
.
keras
.
optimizers
.
legacy
.
SGD
(
learning_rate
=
learning_rate
,
momentum
=
0.9
)
else
:
return
tf
.
keras
.
optimizers
.
SGD
(
learning_rate
=
learning_rate
,
momentum
=
0.9
)
return
tf
.
keras
.
optimizers
.
SGD
(
learning_rate
=
learning_rate
,
momentum
=
0.9
)
...
...
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