![]() |
ExecutorFactory exposing hook to construct executors on environment change.
Inherits From: ExecutorFactory
tff.framework.ReconstructOnChangeExecutorFactory(
underlying_stack: tff.framework.ExecutorFactory
,
change_query: Callable[[tff.framework.CardinalitiesType
], bool] = (lambda _: True)
)
When the initialization parameter change_query
returns True
,
ReconstructOnChangeExecutorFactory` constructs a new executor, bypassing
any previously constructed executors.
Methods
clean_up_executor
clean_up_executor(
cardinalities: tff.framework.CardinalitiesType
)
Releases any resources associated to the given cardinalities.
Note that calling this method may invalidate the state of any executors
which have previously been returned by the factory with the cardinalities
argument ; create_executor
should be called again if a new executor which
is safe to use is desired.
Args | |
---|---|
cardinalities
|
The cardinalities of the executor whose state we wish to clear. |
create_executor
create_executor(
cardinalities: tff.framework.CardinalitiesType
) -> tff.framework.Executor
Returns a new or existing executor, depending on change_query
.
create_executor
constructs a new executor whenever change_query
returns
True
when called with argument cardinalities
. If change_query
returns
False
, create_executor
is free to inspect its internal executor cache
and return a previously constructed executor if one is available.
Args | |
---|---|
cardinalities
|
A mapping from placement literals to ints. |
Returns | |
---|---|
An executor_base.Executor obeying the semantics above.
|