tff.program.DatasetDataSourceIterator
Stay organized with collections
Save and categorize content based on your preferences.
A tff.program.FederatedDataSourceIterator
backed by tf.data.Dataset
s.
Inherits From: FederatedDataSourceIterator
tff.program.DatasetDataSourceIterator(
datasets: Sequence[tf.data.Dataset],
federated_type: tff.types.FederatedType
)
A tff.program.FederatedDataSourceIterator
backed by a sequence of
tf.data.Dataset's, one
tf.data.Dataset' per client. It selects datasources
uniformly at random, with replacement over successive calls of select()
but
without replacement within a single call of select()
.
Args |
datasets
|
A sequence of tf.data.Dataset's to use to yield the data from
this data source.
</td>
</tr><tr>
<td> federated_type<a id="federated_type"></a>
</td>
<td>
The type of the data returned by calling select` on an
iterator.
|
Raises |
ValueError
|
If datasets is empty or if each tf.data.Dataset in
datasets does not have the same type specification.
|
Attributes |
federated_type
|
The type of the data returned by calling select .
|
Methods
from_bytes
View source
@classmethod
from_bytes(
buffer: bytes
) -> 'DatasetDataSourceIterator'
Deserializes the object from bytes.
select
View source
select(
k: Optional[int] = None
) -> object
Returns a new selection of data from this iterator.
Args |
k
|
A number of elements to select. Must be a positive integer and less
than the number of datasets .
|
Raises |
ValueError
|
If k is not a positive integer or if k is not less than
the number of datasets .
|
to_bytes
View source
to_bytes() -> bytes
Serializes the object to bytes.
__eq__
View source
__eq__(
other: object
) -> bool
Return self==value.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-20 UTC.
[null,null,["Last updated 2024-09-20 UTC."],[],[],null,["# tff.program.DatasetDataSourceIterator\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/federated/blob/v0.87.0 Version 2.0, January 2004 Licensed under the Apache License, Version 2.0 (the) |\n\nA [`tff.program.FederatedDataSourceIterator`](../../tff/program/FederatedDataSourceIterator) backed by [`tf.data.Dataset`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset)s.\n\nInherits From: [`FederatedDataSourceIterator`](../../tff/program/FederatedDataSourceIterator) \n\n tff.program.DatasetDataSourceIterator(\n datasets: Sequence[tf.data.Dataset],\n federated_type: ../../tff/types/FederatedType\n )\n\nA [`tff.program.FederatedDataSourceIterator`](../../tff/program/FederatedDataSourceIterator) backed by a sequence of\n`tf.data.Dataset's, one`tf.data.Dataset' per client. It selects datasources\nuniformly at random, with replacement over successive calls of `select()` but\nwithout replacement within a single call of `select()`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `datasets` | A sequence of `tf.data.Dataset's to use to yield the data from this data source. \u003c/td\u003e \u003c/tr\u003e\u003ctr\u003e \u003ctd\u003e`federated_type`\u003ca id=\"federated_type\"\u003e\u003c/a\u003e \u003c/td\u003e \u003ctd\u003e The type of the data returned by calling`select\\` on an iterator. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `ValueError` | If `datasets` is empty or if each [`tf.data.Dataset`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset) in `datasets` does not have the same type specification. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|------------------|----------------------------------------------------|\n| `federated_type` | The type of the data returned by calling `select`. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `from_bytes`\n\n[View source](https://github.com/tensorflow/federated/blob/v0.87.0\nVersion 2.0, January 2004\nLicensed under the Apache License, Version 2.0 (the) \n\n @classmethod\n from_bytes(\n buffer: bytes\n ) -\u003e 'DatasetDataSourceIterator'\n\nDeserializes the object from bytes.\n\n### `select`\n\n[View source](https://github.com/tensorflow/federated/blob/v0.87.0\nVersion 2.0, January 2004\nLicensed under the Apache License, Version 2.0 (the) \n\n select(\n k: Optional[int] = None\n ) -\u003e object\n\nReturns a new selection of data from this iterator.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|-----|----------------------------------------------------------------------------------------------------|\n| `k` | A number of elements to select. Must be a positive integer and less than the number of `datasets`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ||\n|--------------|---------------------------------------------------------------------------------------|\n| `ValueError` | If `k` is not a positive integer or if `k` is not less than the number of `datasets`. |\n\n\u003cbr /\u003e\n\n### `to_bytes`\n\n[View source](https://github.com/tensorflow/federated/blob/v0.87.0\nVersion 2.0, January 2004\nLicensed under the Apache License, Version 2.0 (the) \n\n to_bytes() -\u003e bytes\n\nSerializes the object to bytes.\n\n### `__eq__`\n\n[View source](https://github.com/tensorflow/federated/blob/v0.87.0\nVersion 2.0, January 2004\nLicensed under the Apache License, Version 2.0 (the) \n\n __eq__(\n other: object\n ) -\u003e bool\n\nReturn self==value."]]