tff.framework.thread_debugging_executor_factory

Constructs a simplified execution stack to execute local computations.

The constructed executors support a limited set of TFF's computations. In particular, the debug executor can only resolve references at the top level of the stack, and therefore assumes that all local computation is expressed in pure TensorFlow.

The debug executor makes particular guarantees about the structure of the stacks it constructs which are intended to make them maximally easy to reason about. That is, the debug executor will essentially execute exactly the computation it is passed (in particular, this implies that there are no caching layers), and uses its declared inability to execute arbitrary TFF lambdas to reduce the complexity of the constructed stack. Every debugging executor will have a similar structure, the simplest structure that can execute the full expressivity of TFF while running each client in a dedicated thread:

                  ReferenceResolvingExecutor
                            |
                      FederatingExecutor
                    /       ...         \

ThreadDelegatingExecutor ThreadDelegatingExecutor | | EagerTFExecutor EagerTFExecutor

This structure can be useful in understanding the concurrency pattern of TFF execution, and where the TFF runtime infers data dependencies.

default_num_clients The number of clients to run by default if cardinality cannot be inferred from arguments.
clients_per_thread Integer number of clients for each of TFF's threads to run in sequence. Increasing clients_per_thread therefore reduces the concurrency of the TFF runtime, which can be useful if client work is very lightweight or models are very large and multiple copies cannot fit in memory.
leaf_executor_fn A function that constructs leaf-level executors. Default is the eager TF executor (other possible options: XLA, IREE). Should accept the device keyword argument if the executor is to be configured with explicitly chosen devices.

An instance of executor_factory.ExecutorFactory encapsulating the executor construction logic specified above.

ValueError If the number of clients is specified and not one or larger.