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.

num_clients The number of clients. If specified, the executor factory function returned by local_executor_factory will be configured to have exactly num_clients clients. If unspecified (None), then the function returned will attempt to infer cardinalities of all placements for which it is passed values.
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.

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.