tff.aggregators.add_measurements
Stay organized with collections
Save and categorize content based on your preferences.
Wraps AggregationFactory
to report additional measurements.
tff.aggregators.add_measurements(
inner_agg_factory: tff.aggregators.AggregationFactory
,
*,
client_measurement_fn: Optional[Callable[..., dict[str, Any]]] = None,
server_measurement_fn: Optional[Callable[..., dict[str, Any]]] = None
) -> tff.aggregators.AggregationFactory
The function client_measurement_fn
should be a Python callable that will be
called as client_measurement_fn(value)
or client_measurement_fn(value,
weight)
depending on whether inner_agg_factory
is weighted or unweighted.
It must be traceable by TFF and expect tff.Value
objects placed at CLIENTS
as inputs, and return a collections.OrderedDict
mapping string names to
tensor values placed at SERVER
, which will be added to the measurement dict
produced by the inner_agg_factory
.
Similarly, server_measurement_fn
should be a Python callable that will be
called as server_measurement_fn(result)
where result
is the result (on
server) of the inner aggregation.
One or both of client_measurement_fn
and server_measurement_fn
must be
specified.
Args |
inner_agg_factory
|
The factory to wrap and add measurements.
|
client_measurement_fn
|
A Python callable that will be called on value
(and/or weight ) provided to the next function to compute additional
measurements of the client values/weights.
|
server_measurement_fn
|
A Python callable that will be called on the result
of aggregation at server to compute additional measurements of the result.
|
Returns |
An AggregationFactory that reports additional measurements.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-20 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-20 UTC."],[],[]]