tff.simulation.compose_dataset_computation_with_iterative_process  |  TensorFlow Federated (original) (raw)

tff.simulation.compose_dataset_computation_with_iterative_process

Stay organized with collections Save and categorize content based on your preferences.

Builds a new iterative process which constructs datasets on clients.

tff.simulation.compose_dataset_computation_with_iterative_process(
    dataset_computation: tff.Computation,
    process: tff.templates.IterativeProcess
) -> tff.templates.IterativeProcess

Used in the notebooks

Used in the tutorials
Working with tff's ClientData.

Given a tff.Computation that returns a tf.data.Dataset, and atff.templates.IterativeProcess where exactly one of the arguments is a dataset placed on clients of the same type as returned by thetff.Computation, this function will construct a newtff.templates.IterativeProcess whose next function accepts a federated set of values of the same type as the parameter of the dataset_computation, mapsdataset_computation over these values, and proceeds with the body ofprocess.next.

For example, if the type signature of dataset_computation is:

(T -> U*)

and the type signature of process.next is:

(<S, {U*}@CLIENTS> -> <S, V>

then the returned tff.templates.IterativeProcess.next type signature will be:

(<S, {T}@CLIENTS> -> <S, V>)

This functionality is useful in several settings:

Args
dataset_computation An instance of tff.Computation which accepts some parameter and returns an element of tff.SequenceType.
process An instance of tff.templates.IterativeProcess whose next function accepts exactly one federated dataset, IE, element of type {B*}@CLIENTS, where B is equivalent to the return type of dataset_computation.
Returns
A new tff.templates.IterativeProcess satisfying the specification above.
Raises
TypeError If the arguments are of the wrong types, or their TFF type signatures are incompatible with the specification of this function.