Decorates/wraps Python functions as TFF federated/composite computations.
tff.federated_computation(
*args, **kwargs
)
Used in the notebooks
Used in the tutorials |
---|
The term federated computation as used here refers to any computation that uses TFF programming abstractions. Examples of such computations may include federated training or federated evaluation that involve both client-side and server-side logic and involve network communication. However, this decorator/wrapper can also be used to construct composite computations that only involve local processing on a client or on a server.
The main feature that distinguishes federated computation function bodies
in Python from the bodies of TensorFlow defuns is that whereas in the latter,
one slices and dices tf.Tensor
instances using a variety of TensorFlow ops,
in the former one slices and dices tff.Value
instances using TFF operators.
The supported modes of usage are identical to those for
tff.tensorflow.computation
.
Example | |
---|---|
The above defines |
Args | |
---|---|
*args
|
Either a Python function, or TFF type spec, or both (function first),
or neither. See also tff.tensorflow.computation for an extended
documentation.
|
Returns | |
---|---|
If invoked with a function as an argument, returns an instance of a TFF
computation constructed based on this function. If called without one, as
in the typical decorator style of usage, returns a callable that expects
to be called with the function definition supplied as a parameter. See
also tff.tensorflow.computation for an extended documentation.
|