Have a question? Connect with the community at the TensorFlow Forum Visit Forum

tff.framework.ResourceManagingExecutorFactory

Implementation of executor factory holding an executor per cardinality.

Inherits From: ExecutorFactory

executor_stack_fn Callable taking a mapping from placements.PlacementLiteral to integers, and returning an executor_base.Executor. The returned executor will be configured to handle these cardinalities.
ensure_closed Optional sequence of executor_base.Excutors which should always be closed on a clean_up_executors call. Defaults to empty.

Methods

clean_up_executors

View source

Calls close on all constructed executors, resetting internal cache.

If a caller holds a name bound to any of the executors returned from create_executor, this executor should be assumed to be in an invalid state, and should not be used after this method is called. Instead, callers should again invoke create_executor.

create_executor

View source

Constructs or gets existing executor.

Returns a previously-constructed executor if this method has already been invoked with cardinalities. If not, invokes self._executor_stack_fn with cardinalities and returns the result.

Args
cardinalities dict with placements.PlacementLiteral keys and integer values, specifying the population size at each placement. The executor stacks returned from this method are not themselves polymorphic; a concrete stack must have fixed sizes at each placement.

Returns
Instance of executor_base.Executor as described above.