TensorFlow 2.0 Beta is available Learn more


Merges all the tuples of intrinsics in comp into one intrinsic.


Defined in python/core/impl/transformations.py.

This transform traverses comp postorder, matches the following pattern, and replaces the following computation containing a tuple of called intrinsics all represeting the same operation:

     [Call,                        Call, ...]
     /    \                       /    \

Intrinsic Tuple Intrinsic Tuple | | [Comp(f1), Comp(v1), ...] [Comp(f2), Comp(v2), ...]

), Intrinsic()>

with the following computation containing one called intrinsic:

federated_unzip(Call) /
Intrinsic Tuple | [Block, federated_zip(Tuple), ...] / \ | [fn=Tuple] Lambda(arg) [Comp(v1), Comp(v2), ...] |
[Comp(f1), Comp(f2), ...] Tuple | [Call, Call, ...] / \ /
Sel(0) Sel(0) Sel(1) Sel(1) / / / / Ref(fn) Ref(arg) Ref(fn) Ref(arg)

Intrinsic(< (let fn= in (arg -> )), ,


The functional computations f1, f2, etc..., and the computations v1, v2, etc... are retained; the other computations are replaced.

NOTE: This is just an example of what this transformation would look like when applied to a tuple of federated maps. The components f1, f2, v1, and v2 and the number of those components are not important.

This transformation is implemented to match the following intrinsics:

  • intrinsic_defs.FEDERATED_AGGREGATE.uri
  • intrinsic_defs.FEDERATED_APPLY.uri
  • intrinsic_defs.FEDERATED_BROADCAST.uri
  • intrinsic_defs.FEDERATED_MAP.uri


  • comp: The computation building block in which to perform the merges.
  • uri: The URI of the intrinsic to merge.


A new computation with the transformation applied or the original comp.


  • TypeError: If types do not match.