Join us at TensorFlow World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

tff.framework.replace_intrinsics_with_bodies

View source

Reduces intrinsics to their bodies as defined in intrinsic_bodies.py.

tff.framework.replace_intrinsics_with_bodies(comp)

This function operates on the AST level; meaning, it takes in a building_blocks.ComputationBuildingBlock as an argument and returns one as well. replace_intrinsics_with_bodies is intended to be the standard reduction function, which will reduce all currently implemented intrinsics to their bodies.

Notice that the success of this function depends on the contract of intrinsic_bodies.get_intrinsic_bodies, that the dict returned by that function is ordered from more complex intrinsic to less complex intrinsics.

Args:

  • comp: Instance of building_blocks.ComputationBuildingBlock in which we wish to replace all intrinsics with their bodies.

Returns:

An instance of building_blocks.ComputationBuildingBlock with all intrinsics defined in intrinsic_bodies.py replaced with their bodies.