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
f272e5f2
Commit
f272e5f2
authored
4 years ago
by
Zachary Garrett
Committed by
tensorflow-copybara
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Update federated_sgd_test unittests to reflect improvements made in #
4ed574ab
PiperOrigin-RevId: 322178848
parent
4ed574ab
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tensorflow_federated/python/learning/BUILD
+0
-1
0 additions, 1 deletion
tensorflow_federated/python/learning/BUILD
tensorflow_federated/python/learning/federated_sgd_test.py
+10
-10
10 additions, 10 deletions
tensorflow_federated/python/learning/federated_sgd_test.py
with
10 additions
and
11 deletions
tensorflow_federated/python/learning/BUILD
+
0
−
1
View file @
f272e5f2
...
...
@@ -109,7 +109,6 @@ py_test(
"
:keras_utils
"
,
"
:model_examples
"
,
"
:model_utils
"
,
"
//tensorflow_federated/python/common_libs:anonymous_tuple
"
,
"
//tensorflow_federated/python/common_libs:test
"
,
],
)
...
...
This diff is collapsed.
Click to expand it.
tensorflow_federated/python/learning/federated_sgd_test.py
+
10
−
10
View file @
f272e5f2
...
...
@@ -18,7 +18,6 @@ from absl.testing import parameterized
import
numpy
as
np
import
tensorflow
as
tf
from
tensorflow_federated.python.common_libs
import
anonymous_tuple
from
tensorflow_federated.python.common_libs
import
test
from
tensorflow_federated.python.learning
import
federated_sgd
from
tensorflow_federated.python.learning
import
keras_utils
...
...
@@ -126,10 +125,12 @@ class FederatedSGDTffTest(test.TestCase, parameterized.TestCase):
for
_
in
range
(
num_iterations
):
server_state
,
metric_outputs
=
iterative_process
.
next
(
server_state
,
federated_ds
)
self
.
assertEqual
(
metric_outputs
.
train
.
num_examples
,
train_metrics
=
metric_outputs
[
'
train
'
]
self
.
assertEqual
(
train_metrics
[
'
num_examples
'
],
num_iterations
*
len
(
federated_ds
))
self
.
assertLess
(
metric_outputs
.
train
.
loss
,
prev_loss
)
prev_loss
=
metric_outputs
.
train
.
loss
loss
=
train_metrics
[
'
loss
'
]
self
.
assertLess
(
loss
,
prev_loss
)
prev_loss
=
loss
@parameterized.named_parameters
([
(
'
functional_model
'
,
...
...
@@ -186,12 +187,11 @@ class FederatedSGDTffTest(test.TestCase, parameterized.TestCase):
self
.
assertAllClose
(
list
(
first_state
.
model
.
trainable
),
[[[
0.0
],
[
0.0
]],
0.0
])
self
.
assertEqual
(
anonymous_tuple
.
name_list
(
metric_outputs
),
[
'
broadcast
'
,
'
aggregation
'
,
'
train
'
])
self
.
assertEmpty
(
metric_outputs
.
broadcast
)
self
.
assertEmpty
(
metric_outputs
.
aggregation
)
self
.
assertEqual
(
metric_outputs
.
train
.
num_examples
,
0
)
self
.
assertTrue
(
tf
.
math
.
is_nan
(
metric_outputs
.
train
.
loss
))
list
(
metric_outputs
.
keys
()),
[
'
broadcast
'
,
'
aggregation
'
,
'
train
'
])
self
.
assertEmpty
(
metric_outputs
[
'
broadcast
'
])
self
.
assertEmpty
(
metric_outputs
[
'
aggregation
'
])
self
.
assertEqual
(
metric_outputs
[
'
train
'
][
'
num_examples
'
],
0
)
self
.
assertTrue
(
tf
.
math
.
is_nan
(
metric_outputs
[
'
train
'
][
'
loss
'
]))
if
__name__
==
'
__main__
'
:
...
...
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