aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/tensorboard/components/tf-graph-common/lib/hierarchy.ts
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/tensorboard/components/tf-graph-common/lib/hierarchy.ts')
-rw-r--r--tensorflow/tensorboard/components/tf-graph-common/lib/hierarchy.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/tensorflow/tensorboard/components/tf-graph-common/lib/hierarchy.ts b/tensorflow/tensorboard/components/tf-graph-common/lib/hierarchy.ts
index 1dba760aae..8dca63c9ab 100644
--- a/tensorflow/tensorboard/components/tf-graph-common/lib/hierarchy.ts
+++ b/tensorflow/tensorboard/components/tf-graph-common/lib/hierarchy.ts
@@ -515,6 +515,13 @@ function addEdges(h: Hierarchy, graph: SlimGraph,
let sourceAncestorIndex = getPath(graph.nodes[baseEdge.v], sourcePath);
let destAncestorIndex = getPath(graph.nodes[baseEdge.w], destPath);
+ // If the hierarchical path cannot be found for either endpoint, then we
+ // cannot create the edge. This happens for example when a node has a
+ // control dependency on a summary node, which are embedded.
+ if (sourceAncestorIndex === -1 || destAncestorIndex === -1) {
+ return;
+ }
+
// Find the lowest shared ancestor between source and dest by looking for
// the highest nodes that differ between their ancestor paths.
while (sourcePath[sourceAncestorIndex] === destPath[destAncestorIndex]) {