TensorFlow 2.0 Beta is available Learn more

tff.framework.remove_mapped_or_applied_identity

Removes all the mapped or applied identity functions in comp.

tff.framework.remove_mapped_or_applied_identity(comp)

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

This transform traverses comp postorder, matches the following pattern, and removes all the mapped or applied identity fucntions by replacing the following computation:

      Call
     /    \

Intrinsic Tuple | [Lambda(x), Comp(y)]
Ref(x)

Intrinsic(<(x -> x), y>)

with its argument:

Comp(y)

y

Args:

  • comp: The computation building block in which to perform the removals.

Returns:

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

Raises:

  • TypeError: If types do not match.