Merges all the tuples of intrinsics in
comp into one intrinsic.
tff.framework.merge_tuple_intrinsics( comp, uri )
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:
Tuple | [Call, Call, ...] / \ / \
Intrinsic Tuple Intrinsic Tuple | | [Comp(f1), Comp(v1), ...] [Comp(f2), Comp(v2), ...]
with the following computation containing one called intrinsic:
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=
The functional computations
f2, etc..., and the computations
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
and the number of those components are not important.
This transformation is implemented to match the following intrinsics:
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
TypeError: If types do not match.