Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

Module: tff.utils

View source on GitHub

Utility classes/functions built on top of TensorFlow Federated Core API.

All components that depend on utils should import symbols from this file rather than directly importing individual modules. For this reason, the visibility for the latter is set to private and should remain such. The code in utils must not depend on implementation classes. It should be written against the Core API.


class IterativeProcess: A process that includes an initialization and iterated computation.

class StatefulAggregateFn: A simple container for a stateful aggregation function.

class StatefulBroadcastFn: A simple container for a stateful broadcast function.


assign(...): Creates an op that assigns target from source.

build_dp_aggregate(...): Builds a stateful aggregator for tensorflow_privacy DPQueries.

build_dp_query(...): Makes a DPQuery to estimate vector averages with differential privacy.

build_encoded_broadcast(...): Builds StatefulBroadcastFn for values, to be encoded by encoders.

build_encoded_mean(...): Builds StatefulAggregateFn for values, to be encoded by encoders.

build_encoded_sum(...): Builds StatefulAggregateFn for values, to be encoded by encoders.

create_variables(...): Creates a set of variables that matches the given type_spec.

federated_max(...): Aggregation to find the maximum value from the tff.CLIENTS.

federated_min(...): Aggregation to find the minimum value from the tff.CLIENTS.

federated_sample(...): Aggregation to produce uniform sample of at most max_num_samples values.

identity(...): Applies tf.identity pointwise to source.

update_state(...): Returns a new state with new values for fields in kwargs.