# tff.framework.ExecutorFactory

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) 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) |

Interface defining executor factories.

`ExecutorFactory` should be considered to own the executors it creates; it
is responsible for their instantiation and management.

`ExecutorFactory` exposes two methods, `create_executor` and
`clean_up_executors`. There is a particular coupling between these two
methods; any executor returned by `create_executor` should not be used
after `clean_up_executors` has been called without reinitialization. That is,
`create_executor` should be called again, and `ExecutorFactory` will ensure
that the returned executor is safe for use.

## Methods

### `clean_up_executor`

[View source](https://github.com/tensorflow/federated/blob/v0.87.0
Version 2.0, January 2004
Licensed under the Apache License, Version 2.0 (the)

    @abc.abstractmethod
    clean_up_executor(
        cardinalities: https://www.tensorflow.org/federated/api_docs/python/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.

<br />

<br />

<br />

| Args ||
|---|---|
| `cardinalities` | The cardinalities of the executor whose state we wish to clear. |

<br />

### `create_executor`

[View source](https://github.com/tensorflow/federated/blob/v0.87.0
Version 2.0, January 2004
Licensed under the Apache License, Version 2.0 (the)

    @abc.abstractmethod
    create_executor(
        cardinalities: https://www.tensorflow.org/federated/api_docs/python/tff/framework/CardinalitiesType
    ) -> executor_base.Executor

Abstract method to construct instance of `executor_base.Executor`.

`create_executor` must accept a dict mapping
`placements.PlacementLiterals` to `ints`, and return an
`executor_base.Executor`.

<br />

<br />

<br />

| Args ||
|---|---|
| `cardinalities` | a dict mapping instances of `placements.PlacementLiteral` to ints, specifying the population size at each placement. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| Instance of `executor_base.Executor`. ||

<br />