View source on GitHub
|
An abstract interface for representing federated data source iterators.
This interface abstracts away the specifics of iterating over data in a data source.
Things one can do with a data source iterator:
Determine the type of the data supplied by this iterator by inspecting the
federated_typeproperty. The type returned must match that of the data source that returned this iterator.Return a new selection of federated data from the iterator by invoking
select.
Please see tff.program.FederatedDataSource for additional context and the
high-level description of how to use data sources.
Attributes | |
|---|---|
federated_type
|
The type of the data returned by calling select.
|
Methods
from_bytes
@classmethod@abc.abstractmethodfrom_bytes( buffer: bytes ) -> 'Serializable'
Deserializes the object from bytes.
select
@abc.abstractmethodselect( k: Optional[int] = None ) -> object
Returns a new selection of federated data from this iterator.
| Args | |
|---|---|
k
|
An optional number of elements to select. Must be a positive integer,
or None if unspecified.
|
| Returns | |
|---|---|
An object of type federated_type representing the selected data, and
that can be supplied as an argument to a tff.Computation. See
tff.program.FederatedContext for more information about these types.
|
to_bytes
@abc.abstractmethodto_bytes() -> bytes
Serializes the object to bytes.
View source on GitHub