Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tensorflow-federated
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
tensorflow-federated
Commits
4da4cf14
Commit
4da4cf14
authored
4 years ago
by
Sergei Shmulyian
Committed by
tensorflow-copybara
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
add LAMB to the list of supported optimizers
PiperOrigin-RevId: 322895995
parent
79f99345
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tensorflow_federated/python/research/optimization/shared/optimizer_utils.py
+12
-7
12 additions, 7 deletions
...ed/python/research/optimization/shared/optimizer_utils.py
with
12 additions
and
7 deletions
tensorflow_federated/python/research/optimization/shared/optimizer_utils.py
+
12
−
7
View file @
4da4cf14
...
...
@@ -14,12 +14,12 @@
"""
Optimizer utilities supporting federated averaging experiments.
"""
import
inspect
from
typing
import
Callable
from
typing
import
Optional
from
typing
import
Callable
,
List
,
Optional
from
absl
import
flags
from
absl
import
logging
import
tensorflow
as
tf
import
tensorflow_addons.optimizers
as
tfao
from
tensorflow_federated.python.research.optimization.shared
import
yogi
...
...
@@ -33,7 +33,7 @@ def _optimizer_canonical_name(optimizer_cls):
_SUPPORTED_OPTIMIZERS
=
{
_optimizer_canonical_name
(
cls
):
cls
for
cls
in
[
tf
.
keras
.
optimizers
.
SGD
,
tf
.
keras
.
optimizers
.
Adagrad
,
tf
.
keras
.
optimizers
.
Adam
,
yogi
.
Yogi
tf
.
keras
.
optimizers
.
Adam
,
yogi
.
Yogi
,
tfao
.
lamb
.
LAMB
]
}
...
...
@@ -117,11 +117,16 @@ def define_optimizer_flags(prefix: str) -> None:
define_flag_fn
=
flags
.
DEFINE_integer
elif
is_param_of_type
(
param
,
str
):
define_flag_fn
=
flags
.
DEFINE_string
elif
is_param_of_type
(
param
,
List
[
str
]):
define_flag_fn
=
flags
.
DEFINE_multi_string
else
:
raise
NotImplementedError
(
'
Cannot handle flag [{!s}] of type [{!s}] on
'
'
optimizers [{!s}]
'
.
format
(
param
.
name
,
type
(
param
.
default
),
optimizer_name
))
raise
NotImplementedError
(
'
Cannot define flag [{!s}]
'
'
for parameter [{!s}] of type [{!s}]
'
'
(default value type [{!s}])
'
'
on optimizer [{!s}]
'
.
format
(
prefixed
(
param
.
name
),
param
.
name
,
param
.
annotation
,
type
(
param
.
default
),
optimizer_name
))
define_flag_fn
(
name
=
prefixed
(
param
.
name
),
default
=
param
.
default
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment