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

Function _reroute_sgv_inputs

tensorflow/contrib/graph_editor/reroute.py:314–341  ·  view source on GitHub ↗

Re-route all the inputs of two subgraphs. Args: sgv0: the first subgraph to have its inputs swapped. This argument is converted to a subgraph using the same rules than the function subgraph.make_view. sgv1: the second subgraph to have its inputs swapped. This argument is

(sgv0, sgv1, mode)

Source from the content-addressed store, hash-verified

312
313
314def _reroute_sgv_inputs(sgv0, sgv1, mode):
315 """Re-route all the inputs of two subgraphs.
316
317 Args:
318 sgv0: the first subgraph to have its inputs swapped. This argument is
319 converted to a subgraph using the same rules than the function
320 subgraph.make_view.
321 sgv1: the second subgraph to have its inputs swapped. This argument is
322 converted to a subgraph using the same rules than the function
323 subgraph.make_view.
324 mode: reroute mode, see _reroute_ts(...).
325 Returns:
326 A tuple `(sgv0, sgv1)` of subgraph views with their inputs swapped.
327 Note that the function argument sgv0 and sgv1 are also modified in place.
328 Raises:
329 StandardError: if sgv0 or sgv1 cannot be converted to a SubGraphView using
330 the same rules than the function subgraph.make_view.
331 """
332 sgv0 = _subgraph.make_view(sgv0)
333 sgv1 = _subgraph.make_view(sgv1)
334 _util.check_graphs(sgv0, sgv1)
335 can_modify = sgv0.ops + sgv1.ops
336 # also allow consumers of passthrough to be modified:
337 can_modify += _util.get_consuming_ops(sgv0.passthroughs)
338 can_modify += _util.get_consuming_ops(sgv1.passthroughs)
339 _reroute_ts(sgv0.inputs, sgv1.inputs, mode, can_modify=can_modify)
340 _reroute_sgv_remap(sgv0, sgv1, mode)
341 return sgv0, sgv1
342
343
344def _reroute_sgv_outputs(sgv0, sgv1, mode):

Callers 3

_reroute_sgvFunction · 0.85
swap_inputsFunction · 0.85
reroute_inputsFunction · 0.85

Calls 2

_reroute_tsFunction · 0.85
_reroute_sgv_remapFunction · 0.85

Tested by

no test coverage detected