Detach all the external control outputs of the subgraph sgv. Args: sgv: the subgraph view to be detached. This argument is converted to a subgraph using the same rules as the function subgraph.make_view. control_outputs: a util.ControlOutputs instance.
(sgv, control_outputs)
| 49 | |
| 50 | |
| 51 | def detach_control_outputs(sgv, control_outputs): |
| 52 | """Detach all the external control outputs of the subgraph sgv. |
| 53 | |
| 54 | Args: |
| 55 | sgv: the subgraph view to be detached. This argument is converted to a |
| 56 | subgraph using the same rules as the function subgraph.make_view. |
| 57 | control_outputs: a util.ControlOutputs instance. |
| 58 | """ |
| 59 | if not isinstance(control_outputs, util.ControlOutputs): |
| 60 | raise TypeError("Expected a util.ControlOutputs, got: {}", |
| 61 | type(control_outputs)) |
| 62 | control_outputs.update() |
| 63 | sgv = subgraph.make_view(sgv) |
| 64 | for op in sgv.ops: |
| 65 | for cop in control_outputs.get(op): |
| 66 | if cop not in sgv.ops: |
| 67 | reroute.remove_control_inputs(cop, op) |
| 68 | |
| 69 | |
| 70 | def detach_inputs(sgv, control_inputs=False): |
no test coverage detected