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


View source on GitHub

A simple container for a stateful broadcast function.

    initialize_fn, next_fn

A typical (though trivial) example would be:

stateless_federated_broadcast = tff.utils.StatefulBroadcastFn(
  initialize_fn=lambda: (),
  next_fn=lambda state, value: (
      state, tff.federated_broadcast(value)))


  • initialize_fn: A no-arg function that returns a Python container which can be converted to a tff.Value, placed on the tff.SERVER, and passed as the first argument of __call__. This may be called in vanilla TensorFlow code, typically wrapped as a tff.tf_computation, as part of the initialization of a larger state object.
  • next_fn: A function matching the signature of __call__, see below.



View source

    state, value

Performs a broadcast of value@SERVER, producing value@CLIENTS.

This is a function intended to (only) be invoked in the context of a tff.federated_computation. It shold be compatible with the TFF type signature (state@SERVER, value@SERVER) -> (state@SERVER, value@CLIENTS).



A tuple of tff.Values (state@SERVER, value@CLIENTS) where

  • state: The updated state.
  • value: The input value now placed (communicated) to the tff.CLIENTS.


View source


Returns the initial state.