tff.program.PrefetchingDataSourceIterator

A tff.program.FederatedDataSourceIterator that prefetches data.

Inherits From: FederatedDataSourceIterator

iterator A tff.program.FederatedDataSourceIterator used to prefetch data from.
total_iterations The total number of iterations.
iterations_to_prefetch The number of iterations to prefetch.
k_to_prefetch The number of elements to prefetch per round. Must be greater than 1 and must be identical across all iterations; attempts to select any other number of elements will fail.
prefetch_threshold The threshold below which the data source starts prefetching.

ValueError If k_to_prefetch is not greater than 1.
RuntimeError If the iterator is not constructed in an tff.framework.AsyncExecutionContext.

federated_type The type of the data returned by calling select.

Methods

from_bytes

View source

Deserializes the object from bytes.

select

View source

Returns a new selection of data from this iterator.

Args
k A number of elements to select. Must be a positive integer and equal to k_to_prefetch.

Raises
ValueError If k is not a positive integer or if k is not equal to k_to_prefetch.

to_bytes

View source

Serializes the object to bytes.

__eq__

View source

Return self==value.