![]() |
Runs a federated computation on a given set of client data.
tff.simulation.run_stateless_simulation(
computation: tff.Computation
,
client_selection_fn: Callable[[int], Any],
total_rounds: int,
metrics_managers: Optional[Iterable[release_manager_lib.ReleaseManager]] = None
)
This method performs total_rounds
calls to the computation
. At each round,
this method samples client data via client_selection_fn(round_num)
, and uses
this as input to computation
. The output of computation
is assumed to be
a mutable mapping with string-valued keys.
This method also records how long it takes (in seconds) to call
client_selection_fn
and computation
at each round and adds this to a
dictionary of round metrics with key tff.simulation.ROUND_TIME_KEY
.
Args | |
---|---|
computation
|
A tff.Computation to be executed. Must accept a single
argument (placed or unplaced).
|
client_selection_fn
|
Callable accepting an integer round number, and returning a list of client data to use as federated data for that round. |
total_rounds
|
The number of federated training rounds to perform. |
metrics_managers
|
An optional list of tff.program.ReleaseManagers s to use
to save metrics.
|
Returns | |
---|---|
An dictionary, keyed by round number, with values corresponding to the outputs of each round's computation, with extra keys for timing information. |