|View source on GitHub|
comp's placement, returning a single call to map, apply or value.
tff.framework.unwrap_placement( comp )
For this purpose it is necessary to assume that all processing under
is happening at a single placement.
The other assumptions on inputs of
unwrap_placement are enumerated as
- There is at most one unbound reference under
comp, which is of federated type.
- The only intrinsics present here are apply or map, zip, and federated_valueat*.
- The type signature of
- There are no instances of
building_blocks.Dataof federated type under
comp; how these would be handled by a function such as this is not entirely clear.
Under these conditions,
unwrap_placement will produce a single call to
federated_map, federated_apply or federated_value, depending on the placement
and type signature of
comp. Other than this single map or apply, no
intrinsics will remain under
comp: Instance of
building_blocks.ComputationBuildingBlocksatisfying the assumptions above.
A modified version of
comp, whose root is a single called
intrinsic, and containing no other intrinsics. Equivalent
TypeError: If the lone unbound reference under
compis not of federated type,
compitself is not of federated type, or
compis not a building block.
ValueError: If we encounter a placement other than the one declared by
comp.type_signature, an intrinsic not present in the whitelist above, or
compcontains more than one unbound reference.