Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
tensorflow
GitHub Repository: tensorflow/docs-l10n
Path: blob/master/site/en-snapshot/federated/design/compilation.md
25118 views

Compilation

[TOC]

The compiler package contains data structures defining the Python representation of the AST, core transformation functions, and compiler related functionality.

AST

An abstract syntax tree (AST) in TFF describes the structure of a federated computation.

Building Block

A building_block.ComputationBuildingBlock is the Python representation of the AST.

CompiledComputation

A building_block.CompiledComputation is a building_block.ComputationBuildingBlock that represents a computation that will be delegated to an external runtime. Currently TFF only supports TensorFlow computations, but could be expanded to support Computations backed by other external runtimes.

Computation

A pb.Computation is the Proto or serialized representation of the AST.

TensorFlow Computation

A pb.Computation that represents a Computations that will be delegated to the TensorFlow runtime.

Transformation

A transformation constructs a new AST for a given AST after applying a collection of mutations. Transformations can operate on building blocks in order to transform the Python representation of the AST or on TensorFlow computations in order to transform a tf.Graph.

An atomic transformation is one that applies a single mutation (possibly more than once) to the given input.

A composite transformation is one that applies multiple transformations to the given input in order to provide some feature or assertion.

Note: Transformations can be composed in serial or parallel, meaning that you can construct a composite transformation that performs multiple transformations in one pass through an AST. However, the order in which you apply transformations and how those transformations are parallelized is hard to reason about; as a result, composite transformations are hand-crafted and most are somewhat fragile.

The tree_transformations module contains atomic building block transformations.

The transformations module contains composite building block transformations.

The tensorflow_computation_transformations module contains atomic TensorFlow computation transformations.

The compiled_computation_transformations module contains atomic and composite Compiled Computation transformations.

The transformation_utils module contains functions, traversal logic, and data structures used by other transformation modules.

Compiler

A compiler is a collection of transformations that construct a form that can be executed.