tff.framework.ResourceManagingExecutorFactory
Stay organized with collections
Save and categorize content based on your preferences.
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]
)
Args |
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.
|
Methods
clean_up_executor
View source
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
View source
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.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-20 UTC.
[null,null,["Last updated 2024-09-20 UTC."],[],[],null,["# tff.framework.ResourceManagingExecutorFactory\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/federated/blob/v0.87.0 Version 2.0, January 2004 Licensed under the Apache License, Version 2.0 (the) |\n\nImplementation of executor factory holding an executor per cardinality.\n\nInherits From: [`ExecutorFactory`](../../tff/framework/ExecutorFactory) \n\n tff.framework.ResourceManagingExecutorFactory(\n executor_stack_fn: Callable[[executor_factory.CardinalitiesType], executor_base.Executor]\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `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. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `clean_up_executor`\n\n[View source](https://github.com/tensorflow/federated/blob/v0.87.0\nVersion 2.0, January 2004\nLicensed under the Apache License, Version 2.0 (the) \n\n clean_up_executor(\n cardinalities: ../../tff/framework/CardinalitiesType\n )\n\nCalls `close` on constructed executors, resetting internal cache.\n\nIf a caller holds a name bound to any of the executors returned from\n`create_executor` with the specified cardinalities, this executor\nshould be assumed to be in an invalid state, and should not be used after\nthis method is called. Instead, callers should again invoke\n`create_executor`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|-----------------|-----------------------------------------------------|\n| `cardinalities` | The cardinalities of the executor to be cleaned up. |\n\n\u003cbr /\u003e\n\n### `create_executor`\n\n[View source](https://github.com/tensorflow/federated/blob/v0.87.0\nVersion 2.0, January 2004\nLicensed under the Apache License, Version 2.0 (the) \n\n create_executor(\n cardinalities: ../../tff/framework/CardinalitiesType\n ) -\u003e executor_base.Executor\n\nConstructs or gets existing executor.\n\nReturns a previously-constructed executor if this method has already been\ninvoked with `cardinalities`. If not, invokes `self._executor_stack_fn`\nwith `cardinalities` and returns the result.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `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. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| Instance of `executor_base.Executor` as described above. ||\n\n\u003cbr /\u003e"]]