MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / detach_inputs

Function detach_inputs

tensorflow/contrib/graph_editor/edit.py:70–98  ·  view source on GitHub ↗

Detach the inputs of a subgraph view. 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. Note that sgv is modified in place. control_inputs: if True control_inputs are also detached.

(sgv, control_inputs=False)

Source from the content-addressed store, hash-verified

68
69
70def detach_inputs(sgv, control_inputs=False):
71 """Detach the inputs of a subgraph view.
72
73 Args:
74 sgv: the subgraph view to be detached. This argument is converted to a
75 subgraph using the same rules as the function subgraph.make_view.
76 Note that sgv is modified in place.
77 control_inputs: if True control_inputs are also detached.
78 Returns:
79 A tuple `(sgv, input_placeholders)` where
80 `sgv` is a new subgraph view of the detached subgraph;
81 `input_placeholders` is a list of the created input placeholders.
82 Raises:
83 StandardError: if sgv cannot be converted to a SubGraphView using
84 the same rules than the function subgraph.make_view.
85 """
86 sgv = subgraph.make_view(sgv)
87
88 with sgv.graph.as_default():
89 input_placeholders = [
90 tf_array_ops.placeholder(
91 dtype=input_t.dtype, name=util.placeholder_name(input_t))
92 for input_t in sgv.inputs
93 ]
94
95 reroute.swap_inputs(sgv, input_placeholders)
96 if control_inputs:
97 detach_control_inputs(sgv)
98 return sgv, input_placeholders
99
100
101def detach_outputs(sgv, control_outputs=None):

Callers 2

detachFunction · 0.85
bypassFunction · 0.85

Calls 3

detach_control_inputsFunction · 0.85
as_defaultMethod · 0.45
placeholderMethod · 0.45

Tested by

no test coverage detected