View source on GitHub
|
A tff.program.FederatedDataSourceIterator backed by client ids.
Inherits From: FederatedDataSourceIterator
tff.program.ClientIdDataSourceIterator(
client_ids: Sequence[str]
)
A tff.program.FederatedDataSourceIterator backed by sequence of client ids,
one client id per client. It selects client ids uniformly at random, with
replacement over successive calls of select() but without replacement within
a single call of select().
Args | |
|---|---|
client_ids
|
A sequence of client ids to use to yield the ids from this data source. |
Raises | |
|---|---|
ValueError
|
If client_ids is empty.
|
Attributes | |
|---|---|
federated_type
|
The type of the data returned by calling select.
|
Methods
from_bytes
@classmethodfrom_bytes( buffer: bytes ) -> 'ClientIdDataSourceIterator'
Deserializes the object from bytes.
select
select(
k: Optional[int] = None
) -> object
Returns a new selection of client ids from this iterator.
| Args | |
|---|---|
k
|
A number of elements to select. Must be a positive integer and less
than the number of client_ids.
|
| Raises | |
|---|---|
ValueError
|
If k is not a positive integer or if k is not less than
the number of client_ids.
|
to_bytes
to_bytes() -> bytes
Serializes the object to bytes.
__eq__
__eq__(
other: object
) -> bool
Return self==value.
View source on GitHub