tff.framework.EagerExecutor

View source on GitHub

The eager executor only runs TensorFlow, synchronously, in eager mode.

Inherits From: Executor

tff.framework.EagerExecutor(
    device=None
)

TODO(b/134764569): Add support for data as a building block.

This executor understands the following TFF types: tensors, sequences, named tuples, and functions. It does not understand placements, federated, or abstract types.

This executor understands the following kinds of TFF computation building blocks: tensorflow computations, and external data. It does not understand lambda calculus or any compositional constructs. Tuples and selections can only be created using create_tuple() and create_selection() in the API.

The arguments to be ingested can be Python constants of simple types, nested structures of those, as well as eager tensors and eager datasets.

The external data references must identify files available in the executor's filesystem. The exact format is yet to be documented.

The executor will be able to place work on specific devices (e.g., on GPUs). In contrast to the reference executor, it handles data sets in a pipelined fashion, and does not place limits on the data set sizes. It also avoids marshaling TensorFlow values in and out between calls.

It does not deal with multithreading, checkpointing, federated computations, and other concerns to be covered by separate executor components. It runs the operations it supports in a synchronous fashion. Asynchrony and other aspects not supported here should be handled by composing this executor with other executors into a complex executor stack, rather than mixing in all the logic.

Args:

  • device: An optional name of the device that this executor will schedule all of its operations to run on. It is the caller's responsibility to select a correct device name. For example, the list of physical devices can be obtained using tf.config.experimental.list_physical_devices().

Raises:

  • RuntimeError: If not executing eagerly.
  • TypeError: If the device name is not a string.
  • ValueError: If there is no device device.

Methods

close

View source

close()

Release resources associated with this Executor, if any.

If the executor has one or more target Executors, implementation of this method must close them.

create_call

View source

create_call(
    *args, **kwargs
)

create_selection

View source

create_selection(
    *args, **kwargs
)

create_tuple

View source

create_tuple(
    *args, **kwargs
)

create_value

View source

create_value(
    *args, **kwargs
)