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

Method __call__

tensorflow/contrib/graph_editor/transform.py:410–459  ·  view source on GitHub ↗

Execute the transformation. Args: sgv: the source subgraph-view. dst_graph: the destination graph. dst_scope: the destination scope. src_scope: the source scope, which specify the path from which the relative path of the transformed nodes are computed. For instan

(self,
               sgv,
               dst_graph,
               dst_scope,
               src_scope="",
               reuse_dst_scope=False)

Source from the content-addressed store, hash-verified

408 self.transform_original_op_handler = transform_op_if_inside_handler
409
410 def __call__(self,
411 sgv,
412 dst_graph,
413 dst_scope,
414 src_scope="",
415 reuse_dst_scope=False):
416 """Execute the transformation.
417
418 Args:
419 sgv: the source subgraph-view.
420 dst_graph: the destination graph.
421 dst_scope: the destination scope.
422 src_scope: the source scope, which specify the path from which the
423 relative path of the transformed nodes are computed. For instance, if
424 src_scope is a/ and dst_scoped is b/, then the node a/x/y will have a
425 relative path of x/y and will be transformed into b/x/y.
426 reuse_dst_scope: if True the dst_scope is re-used if it already exists.
427 Otherwise, the scope is given a unique name based on the one given
428 by appending an underscore followed by a digit (default).
429 Returns:
430 A tuple `(sgv, info)` where:
431 `sgv` is the transformed subgraph view;
432 `info` is an instance of TransformerInfo containing
433 information about the transform, including mapping between
434 original and transformed tensors and operations.
435 Raises:
436 ValueError: if the arguments are invalid.
437 """
438 sgv = subgraph.make_view(sgv)
439 if not isinstance(dst_graph, tf_ops.Graph):
440 raise TypeError("Expected a tf.Graph, got: {}".format(type(dst_graph)))
441
442 src_scope = util.scope_finalize(src_scope)
443 dst_scope = util.scope_finalize(dst_scope)
444
445 # Potentially create new scope if reuse_dst_scope is False
446 if dst_scope and not reuse_dst_scope:
447 dst_scope = util.scope_finalize(dst_graph.unique_name(dst_scope[:-1]))
448
449 # Create temporary info used during this transform call
450 info = _TmpInfo(sgv, dst_graph, dst_scope, src_scope)
451
452 self._copy_ops(info)
453 self._finalize_cycles(info)
454 self._connect_control_inputs(info)
455
456 # Compute information about the transformation
457 res_info = TransformerInfo(info)
458 sgv_ = self._transform_sgv(info, sgv)
459 return sgv_, res_info
460
461 def _copy_ops(self, info):
462 """Copy ops without connecting them."""

Callers

nothing calls this directly

Calls 9

_copy_opsMethod · 0.95
_finalize_cyclesMethod · 0.95
_transform_sgvMethod · 0.95
typeFunction · 0.85
_TmpInfoClass · 0.85
TransformerInfoClass · 0.85
unique_nameMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected