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

Function find_corresponding

tensorflow/contrib/graph_editor/util.py:542–566  ·  view source on GitHub ↗

Find corresponding ops/tensors in a different graph. `targets` is a Python tree, that is, a nested structure of iterable (list, tupple, dictionary) whose leaves are instances of `tf.Tensor` or `tf.Operation` Args: targets: A Python tree containing `tf.Tensor` or `tf.Operation` be

(targets, dst_graph, dst_scope="", src_scope="")

Source from the content-addressed store, hash-verified

540
541
542def find_corresponding(targets, dst_graph, dst_scope="", src_scope=""):
543 """Find corresponding ops/tensors in a different graph.
544
545 `targets` is a Python tree, that is, a nested structure of iterable
546 (list, tupple, dictionary) whose leaves are instances of
547 `tf.Tensor` or `tf.Operation`
548
549 Args:
550 targets: A Python tree containing `tf.Tensor` or `tf.Operation`
551 belonging to the original graph.
552 dst_graph: The graph in which the corresponding graph element must be found.
553 dst_scope: A scope which is prepended to the name to look for.
554 src_scope: A scope which is removed from the original of `top` name.
555
556 Returns:
557 A Python tree containin the corresponding tf.Tensor` or a `tf.Operation`.
558
559 Raises:
560 ValueError: if `src_name` does not start with `src_scope`.
561 TypeError: if `top` is not a `tf.Tensor` or a `tf.Operation`
562 KeyError: If the corresponding graph element cannot be found.
563 """
564 def func(top):
565 return find_corresponding_elem(top, dst_graph, dst_scope, src_scope)
566 return transform_tree(targets, func)

Callers

nothing calls this directly

Calls 1

transform_treeFunction · 0.85

Tested by

no test coverage detected