Join TensorFlow at Google I/O, May 11-12 Register now

tff.framework.DataDescriptor

Helper class for representing fully-specified data-yielding computations.

Inherits From: Ingestable, TypedObject, CardinalityCarrying

Instances of this class are objects that may combine a federated computation that returns a portion of federated data and an argument to be supplied as input to this computation, or 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) optionally invokes the computation contained in this descriptor on the 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.

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 materialzied data that's being produces. 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.
cardinality Optional cardinality (e.g., number of clients) to supply if this descriptor represents an instance of federated data.

ValueError if the arguments don't satisfy the constraints listed above.

cardinality Returns the cardinality information associated with this object.
type_signature Returns the TFF type of this object (an instance of tff.Type).

Methods

ingest

View source

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.