tff.framework.CardinalityFreeDataDescriptor
Stay organized with collections
Save and categorize content based on your preferences.
Represent data-yielding computations with unspecified cardinalities.
Inherits From: Ingestable
, TypedObject
tff.framework.CardinalityFreeDataDescriptor(
comp: Optional[tff.Computation
],
arg: object,
arg_type: tff.types.Type
)
Instances of this class are objects that may combine a federated computation
that returns federated data and an argument to be supplied as input to this
computation, or alternatively the argument alone. These objects are designed
to be recognized by the runtime. When ingesting those objects (e.g., as they
are passed as arguments to a computation invocation), the runtime ingests
the argument, and (if provided) invokes the computation contained
in this descriptor on this argument to cause the data to materialize within
the runtime (but without marshaling it out and returning it to user).
In the typical usage of this helper class, the embedded argument is a set of
handles, and the embedded computation transforms those handles into physical
tf.data.Dataset
instances. This transformation occurs on the clients (i.e.,
in the TFF runtime worker processes).
Alternatively, the argument itself may consist of computations to be locally
executed on the clients. In this case, the computation can be omitted.
Args |
comp
|
The computation that materializes the data, of some type (T -> U)
where T is the type of the argument arg and U is the type of the
materialized data that's being produced. This can be None , in which
case it's assumed to be an identity function (and T in that case must
be identical to U ).
|
arg
|
The argument to be passed as input to comp if comp is not None ,
or to be treated as the computed result. Must be recognized by the TFF
runtime as a payload of type T .
|
arg_type
|
The type of the argument (T references above). An instance of
tff.Type .
|
Raises |
ValueError
|
if the arguments don't satisfy the constraints listed above.
|
Attributes |
type_signature
|
Returns the TFF type of this object (an instance of tff.Type ).
|
Methods
ingest
View source
ingest(
executor
)
Causes this object to ingest itself into the given executor.
Args |
executor
|
An instance of executor_base.Executor to ingest into.
|
Returns |
An instance of executor_value_base.ExecutorValue returned by the
executor.
|
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.framework.CardinalityFreeDataDescriptor\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\nRepresent data-yielding computations with unspecified cardinalities.\n\nInherits From: [`Ingestable`](../../tff/framework/Ingestable), [`TypedObject`](../../tff/TypedObject) \n\n tff.framework.CardinalityFreeDataDescriptor(\n comp: Optional[../../tff/Computation],\n arg: object,\n arg_type: ../../tff/types/Type\n )\n\nInstances of this class are objects that may combine a federated computation\nthat returns federated data and an argument to be supplied as input to this\ncomputation, or alternatively the argument alone. These objects are designed\nto be recognized by the runtime. When ingesting those objects (e.g., as they\nare passed as arguments to a computation invocation), the runtime ingests\nthe argument, and (if provided) invokes the computation contained\nin this descriptor on this argument to cause the data to materialize within\nthe runtime (but without marshaling it out and returning it to user).\n\nIn the typical usage of this helper class, the embedded argument is a set of\nhandles, and the embedded computation transforms those handles into physical\n[`tf.data.Dataset`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset) instances. This transformation occurs on the clients (i.e.,\nin the TFF runtime worker processes).\n\nAlternatively, the argument itself may consist of computations to be locally\nexecuted on the clients. In this case, the computation can be omitted.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `comp` | The computation that materializes the data, of some type `(T -\u003e U)` where `T` is the type of the argument `arg` and `U` is the type of the materialized data that's being produced. This can be `None`, in which case it's assumed to be an identity function (and `T` in that case must be identical to `U`). |\n| `arg` | The argument to be passed as input to `comp` if `comp` is not `None`, or to be treated as the computed result. Must be recognized by the TFF runtime as a payload of type `T`. |\n| `arg_type` | The type of the argument (`T` references above). An instance of [`tff.Type`](../../tff/types/Type). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|--------------|--------------------------------------------------------------|\n| `ValueError` | if the arguments don't satisfy the constraints listed above. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|------------------|------------------------------------------------------------------------------------------|\n| `type_signature` | Returns the TFF type of this object (an instance of [`tff.Type`](../../tff/types/Type)). |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `ingest`\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 ingest(\n executor\n )\n\nCauses this object to ingest itself into the given executor.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|------------|---------------------------------------------------------|\n| `executor` | An instance of `executor_base.Executor` to ingest into. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| An instance of `executor_value_base.ExecutorValue` returned by the executor. ||\n\n\u003cbr /\u003e"]]