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

Function copy

tensorflow/contrib/graph_editor/transform.py:591–623  ·  view source on GitHub ↗

Copy a subgraph. Args: sgv: the source subgraph-view. This argument is converted to a subgraph using the same rules than the function subgraph.make_view. dst_graph: the destination graph. dst_scope: the destination scope. src_scope: the source scope. reuse_dst_scope: if

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

Source from the content-addressed store, hash-verified

589
590
591def copy(sgv, dst_graph=None, dst_scope="", src_scope="",
592 reuse_dst_scope=False):
593 """Copy a subgraph.
594
595 Args:
596 sgv: the source subgraph-view. This argument is converted to a subgraph
597 using the same rules than the function subgraph.make_view.
598 dst_graph: the destination graph.
599 dst_scope: the destination scope.
600 src_scope: the source scope.
601 reuse_dst_scope: if True the dst_scope is re-used if it already exists.
602 Otherwise, the scope is given a unique name based on the one given
603 by appending an underscore followed by a digit (default).
604 Returns:
605 A tuple `(sgv, info)` where:
606 `sgv` is the transformed subgraph view;
607 `info` is an instance of TransformerInfo containing
608 information about the transform, including mapping between
609 original and transformed tensors and operations.
610 Raises:
611 TypeError: if `dst_graph` is not a `tf.Graph`.
612 StandardError: if sgv cannot be converted to a SubGraphView using
613 the same rules than the function subgraph.make_view.
614 """
615 sgv = subgraph.make_view(sgv)
616 if dst_graph is None:
617 dst_graph = sgv.graph
618 if not isinstance(dst_graph, tf_ops.Graph):
619 raise TypeError("Expected a tf.Graph, got: {}".format(type(dst_graph)))
620
621 copier = Transformer()
622 return copier(
623 sgv, dst_graph, dst_scope, src_scope, reuse_dst_scope=reuse_dst_scope)
624
625
626def copy_with_input_replacements(sgv, replacement_ts,

Callers 15

ComputeMethod · 0.50
AddExampleMethod · 0.50
BuildGatherOpFunction · 0.50
matchAndRewriteMethod · 0.50
ConcatVectorsFunction · 0.50
SpaceToBatchFunction · 0.50
BatchToSpaceFunction · 0.50
CompileMethod · 0.50
TEST_FFunction · 0.50
TESTFunction · 0.50

Calls 3

typeFunction · 0.85
TransformerClass · 0.70
formatMethod · 0.45

Tested by 14

TEST_FFunction · 0.40
TESTFunction · 0.40
TEST_FFunction · 0.40
MakeArrayFunction · 0.40
CopyTensorElementsFunction · 0.40
TESTFunction · 0.40
CopyCPUToGPUMethod · 0.40
CopyGPUToCPUMethod · 0.40
CopyGPUToGPUMethod · 0.40
CreateAsProtoFieldFunction · 0.40
FillRandomsWithSinglesFunction · 0.40