View source on GitHub |
Implementation of executor factory holding an executor per cardinality.
Inherits From: ExecutorFactory
tff.framework.ResourceManagingExecutorFactory(
executor_stack_fn: Callable[[executor_factory.CardinalitiesType], executor_base.Executor]
)
Methods
clean_up_executor
clean_up_executor(
cardinalities: tff.framework.CardinalitiesType
)
Calls close
on constructed executors, resetting internal cache.
If a caller holds a name bound to any of the executors returned from
create_executor
with the specified cardinalities, 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
.
Args | |
---|---|
cardinalities
|
The cardinalities of the executor to be cleaned up. |
create_executor
create_executor(
cardinalities: tff.framework.CardinalitiesType
) -> executor_base.Executor
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.
|