tff.framework.CompositeExecutor

View source on GitHub

Class CompositeExecutor

An executor composed of subordinate executors that manage disjoint scopes.

Inherits From: Executor

This executor can be used to construct multi-level hierarchical aggregation structures with federated executors managing disjoint subsets of clients at the leaf level.

The intrinsics currently implemented include:

  • federated_aggregate
  • federated_apply
  • federated_broadcast
  • federated_map
  • federated_mean
  • federated_sum
  • federated_value
  • federated_weighted_mean
  • federated_zip

__init__

View source

__init__(
    parent_executor,
    child_executors
)

Creates a composite executor from a collection of subordinate executors.

Args:

  • parent_executor: The parent executor to use for all processing at the parent, such as combining values from child executors, unplaced and server-side processing, etc.
  • child_executors: The list of executors that manage disjoint scopes to combine in this executor, delegate to and collect or aggregate from.

Raises:

  • ValueError: If the value is unrecognized (e.g., a nonexistent intrinsic).

Methods

create_call

View source

create_call(
    *args,
    **kwargs
)

create_selection

View source

create_selection(
    source,
    index=None,
    name=None
)

A coroutine that creates a selection from source.

Args:

  • source: The source to select from. The source must have been embedded in this executor by invoking create_value() on it first.
  • index: An optional integer index. Either this, or name must be present.
  • name: An optional string name. Either this, or index must be present.

Returns:

An instance of executor_value_base.ExecutorValue that represents the constructed selection.

create_tuple

View source

create_tuple(elements)

A coroutine that creates a tuple of elements.

Args:

  • elements: An enumerable or dict with the elements to create a tuple from. The elements must all have been embedded in this executor by invoking create_value() on them first.

Returns:

An instance of executor_value_base.ExecutorValue that represents the constructed tuple.

create_value

View source

create_value(
    *args,
    **kwargs
)