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

Method find_some_path

tensorflow/python/debug/lib/debug_data.py:1153–1229  ·  view source on GitHub ↗

Find a path between a source node and a destination node. Limitation: the source and destination are required to be on the same device, i.e., this method does not yet take into account Send/Recv nodes across devices. TODO(cais): Make this method work across device edges by tracing

(self,
                     src_node_name,
                     dst_node_name,
                     include_control=True,
                     include_reversed_ref=False,
                     device_name=None)

Source from the content-addressed store, hash-verified

1151 return self._merge_node_names[device_name]
1152
1153 def find_some_path(self,
1154 src_node_name,
1155 dst_node_name,
1156 include_control=True,
1157 include_reversed_ref=False,
1158 device_name=None):
1159 """Find a path between a source node and a destination node.
1160
1161 Limitation: the source and destination are required to be on the same
1162 device, i.e., this method does not yet take into account Send/Recv nodes
1163 across devices.
1164
1165 TODO(cais): Make this method work across device edges by tracing Send/Recv
1166 nodes.
1167
1168 Args:
1169 src_node_name: (`str`) name of the source node or name of an output tensor
1170 of the node.
1171 dst_node_name: (`str`) name of the destination node or name of an output
1172 tensor of the node.
1173 include_control: (`bool`) whrther control edges are considered in the
1174 graph tracing.
1175 include_reversed_ref: Whether a ref input, say from A to B, is to be also
1176 considered as an input from B to A. The rationale is that ref inputs
1177 generally let the recipient (e.g., B in this case) mutate the value of
1178 the source (e.g., A in this case). So the reverse direction of the ref
1179 edge reflects the direction of information flow.
1180 device_name: (`str`) name of the device. If there is only one device or if
1181 node_name exists on only one device, this argument is optional.
1182
1183 Returns:
1184 A path from the src_node_name to dst_node_name, as a `list` of `str`, if
1185 it exists. The list includes src_node_name as the first item and
1186 dst_node_name as the last.
1187 If such a path does not exist, `None`.
1188
1189 Raises:
1190 ValueError: If the source and destination nodes are not on the same
1191 device.
1192 """
1193 src_device_name = self._infer_device_name(device_name, src_node_name)
1194 dst_device_name = self._infer_device_name(device_name, dst_node_name)
1195
1196 if src_device_name != dst_device_name:
1197 raise ValueError(
1198 "Source (%s) and destination (%s) are not on the same device: "
1199 "%s vs. %s" % (src_node_name, dst_node_name, src_device_name,
1200 dst_device_name))
1201
1202 input_lists = [self._debug_graphs[dst_device_name].node_inputs]
1203 debug_graph = self._debug_graphs[dst_device_name]
1204 if include_control:
1205 input_lists.append(debug_graph.node_ctrl_inputs)
1206 if include_reversed_ref:
1207 input_lists.append(debug_graph.node_reversed_ref_inputs)
1208 tracer = debug_graphs.DFSGraphTracer(
1209 input_lists,
1210 skip_node_names=self._get_merge_node_names(dst_device_name),

Calls 6

_infer_device_nameMethod · 0.95
_get_merge_node_namesMethod · 0.95
traceMethod · 0.95
inputsMethod · 0.95
depth_listMethod · 0.95
appendMethod · 0.45