A simple container for a stateful broadcast function.
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)))
__init__( initialize_fn, next_fn )
Creates the StatefulFn.
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_compuatation, as part of the initialization of a larger state object.
next_fn: A function matching the signature of
__call__, see below.
__call__( 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
It shold be compatible with the TFF type signature
-> (state@SERVER, value@CLIENTS).
Returns the initial state.