A tff.program.FederatedDataSource
that prefetches data.
Inherits From: FederatedDataSource
tff.program.PrefetchingDataSource(
data_source: tff.program.FederatedDataSource
,
context: tff.framework.AsyncExecutionContext
,
total_rounds: int,
num_rounds_to_prefetch: int,
num_clients_to_prefetch: int,
prefetch_threshold: int = 0
)
Args |
data_source
|
A tff.program.FederatedDataSource used to prefetch data
from.
|
context
|
The tff.framework.AsyncExecutionContext to prefetch data in.
|
total_rounds
|
The total number of rounds.
|
num_rounds_to_prefetch
|
The number of rounds to prefetch.
|
num_clients_to_prefetch
|
The number of clients to prefetch per round. Must
be greater than 1 and must be the same across all rounds; attempts to
select any other number of clients will fail.
|
prefetch_threshold
|
The threshold below which the data source starts
prefetching.
|
Raises |
ValueError
|
If num_clients_to_prefetch is not greater than 1.
|
Attributes |
capabilities
|
The list of capabilities supported by this data source.
|
federated_type
|
The type of the data returned by calling select on an iterator.
|
Methods
iterator
View source
iterator() -> tff.program.PrefetchingDataSourceIterator
Returns a new iterator for retrieving data from this data source.