提交 d5c089f5 authored 作者: Christof Angermueller's avatar Christof Angermueller

Fix lost edge highlight feature

上级 39adc822
...@@ -301,10 +301,7 @@ function setupGraph() { ...@@ -301,10 +301,7 @@ function setupGraph() {
}); });
nodes.on('mouseover', function(node) { nodes.on('mouseover', function(node) {
if (!isProfiled || isEditNode || typeof(node.value.profile) == 'undefined') { // Highlight incoming edges
return;
}
edges.each(function (d, i) { edges.each(function (d, i) {
var edge = d3.select(this); var edge = d3.select(this);
if (d.source == node || d.target == node) { if (d.source == node || d.target == node) {
...@@ -313,13 +310,17 @@ function setupGraph() { ...@@ -313,13 +310,17 @@ function setupGraph() {
.style('opacity', 1.0); .style('opacity', 1.0);
} }
}); });
nodeDiv.transition()
.duration(200) // Show node details if node is not edited as has profiling information
.style('opacity', .9); if (!isEditNode && node.value.profile.length) {
nodeDiv nodeDiv.transition()
.html(nodeDetails(node)) .duration(200)
.style('left', (d3.event.pageX) + 30 + 'px') .style('opacity', .9);
.style('top', (d3.event.pageY - 28) + 'px'); nodeDiv
.html(nodeDetails(node))
.style('left', (d3.event.pageX) + 30 + 'px')
.style('top', (d3.event.pageY - 28) + 'px');
}
}); });
nodes.on('mouseout', function(node) { nodes.on('mouseout', function(node) {
......
digraph G { digraph G {
graph [bb="0,0,2482,251"]; graph [bb="0,0,2478,251"];
node [label="\N"]; node [label="\N"];
subgraph cluster__1 { subgraph cluster__1 {
graph [bb="8,168,723,243", graph [bb="8,168,723,243",
label="theano.compile.builders.OpFromGraph object at 0x1076d9190", label="theano.compile.builders.OpFromGraph object at 0x1141d3a50",
lheight=0.21, lheight=0.21,
lp="365.5,231.5", lp="365.5,231.5",
lwidth=4.90 lwidth=4.89
]; ];
_2 [fillcolor=limegreen, _2 [fillcolor=limegreen,
height=0.5, height=0.5,
...@@ -31,67 +31,67 @@ digraph G { ...@@ -31,67 +31,67 @@ digraph G {
width=3.0625]; width=3.0625];
} }
subgraph cluster__5 { subgraph cluster__5 {
graph [bb="1759,168,2474,243", graph [bb="1755,168,2470,243",
label="theano.compile.builders.OpFromGraph object at 0x1076d9190 id=1", label="theano.compile.builders.OpFromGraph object at 0x1141d3a50 id=1",
lheight=0.21, lheight=0.21,
lp="2116.5,231.5", lp="2112.5,231.5",
lwidth=5.31 lwidth=5.29
]; ];
_6 [fillcolor=limegreen, _6 [fillcolor=limegreen,
height=0.5, height=0.5,
label="name=x TensorType(float64, scalar)", label="name=x TensorType(float64, scalar)",
pos="2355,194", pos="2351,194",
shape=box, shape=box,
style=filled, style=filled,
width=3.0625]; width=3.0625];
_7 [fillcolor=limegreen, _7 [fillcolor=limegreen,
height=0.5, height=0.5,
label="name=y TensorType(float64, scalar)", label="name=y TensorType(float64, scalar)",
pos="2116,194", pos="2112,194",
shape=box, shape=box,
style=filled, style=filled,
width=3.0625]; width=3.0625];
_8 [fillcolor=limegreen, _8 [fillcolor=limegreen,
height=0.5, height=0.5,
label="name=z TensorType(float64, scalar)", label="name=z TensorType(float64, scalar)",
pos="1877,194", pos="1873,194",
shape=box, shape=box,
style=filled, style=filled,
width=3.0556]; width=3.0556];
} }
_1 [height=0.5, _1 [height=0.5,
label="theano.compile.builders.OpFromGraph object at 0x1076d9190", label="theano.compile.builders.OpFromGraph object at 0x1141d3a50",
pos="973,194", pos="972,194",
shape=ellipse, shape=ellipse,
width=6.6504]; width=6.6414];
_9 [fillcolor="#FFAABB", _9 [fillcolor="#FFAABB",
height=0.5, height=0.5,
label="Elemwise{Add}[(0, 0)]", label="Elemwise{Add}[(0, 0)]",
pos="1231,106", pos="1229,106",
shape=ellipse, shape=ellipse,
style=filled, style=filled,
type=colored, type=colored,
width=2.6784]; width=2.6784];
_1 -> _9 [label="TensorType(float64, scalar)", _1 -> _9 [label="1 TensorType(float64, scalar)",
lp="1204,150", lp="1207.5,150",
pos="e,1185.8,122.05 1023.1,176.32 1067,161.66 1130.8,140.38 1176.2,125.28"]; pos="e,1184,122.05 1021.9,176.32 1065.6,161.66 1129.2,140.38 1174.4,125.28"];
_5 [height=0.5, _5 [height=0.5,
label="theano.compile.builders.OpFromGraph object at 0x1076d9190 id=1", label="theano.compile.builders.OpFromGraph object at 0x1141d3a50 id=1",
pos="1490,194", pos="1487,194",
shape=ellipse, shape=ellipse,
width=7.1761]; width=7.167];
_5 -> _9 [color=red, _5 -> _9 [color=red,
label="TensorType(float64, scalar)", label="0 TensorType(float64, scalar)",
lp="1461,150", lp="1464.5,150",
pos="e,1276.3,122.05 1439.8,176.32 1395.6,161.66 1331.5,140.38 1286,125.28"]; pos="e,1274.2,122.05 1436.9,176.32 1393,161.66 1329.2,140.38 1283.8,125.28"];
_10 [fillcolor=dodgerblue, _10 [fillcolor=dodgerblue,
height=0.5, height=0.5,
label="TensorType(float64, scalar) id=5", label="TensorType(float64, scalar) id=5",
pos="1231,18", pos="1229,18",
shape=box, shape=box,
style=filled, style=filled,
width=2.7847]; width=2.7847];
_9 -> _10 [label="TensorType(float64, scalar)", _9 -> _10 [label="TensorType(float64, scalar)",
lp="1309,62", lp="1307,62",
pos="e,1231,36.084 1231,87.597 1231,75.746 1231,59.817 1231,46.292"]; pos="e,1229,36.084 1229,87.597 1229,75.746 1229,59.817 1229,46.292"];
} }
...@@ -301,10 +301,7 @@ function setupGraph() { ...@@ -301,10 +301,7 @@ function setupGraph() {
}); });
nodes.on('mouseover', function(node) { nodes.on('mouseover', function(node) {
if (!isProfiled || isEditNode || typeof(node.value.profile) == 'undefined') { // Highlight incoming edges
return;
}
edges.each(function (d, i) { edges.each(function (d, i) {
var edge = d3.select(this); var edge = d3.select(this);
if (d.source == node || d.target == node) { if (d.source == node || d.target == node) {
...@@ -313,13 +310,17 @@ function setupGraph() { ...@@ -313,13 +310,17 @@ function setupGraph() {
.style('opacity', 1.0); .style('opacity', 1.0);
} }
}); });
nodeDiv.transition()
.duration(200) // Show node details if node is not edited as has profiling information
.style('opacity', .9); if (!isEditNode && node.value.profile.length) {
nodeDiv nodeDiv.transition()
.html(nodeDetails(node)) .duration(200)
.style('left', (d3.event.pageX) + 30 + 'px') .style('opacity', .9);
.style('top', (d3.event.pageY - 28) + 'px'); nodeDiv
.html(nodeDetails(node))
.style('left', (d3.event.pageX) + 30 + 'px')
.style('top', (d3.event.pageY - 28) + 'px');
}
}); });
nodes.on('mouseout', function(node) { nodes.on('mouseout', function(node) {
......
...@@ -3,7 +3,7 @@ digraph G { ...@@ -3,7 +3,7 @@ digraph G {
node [label="\N"]; node [label="\N"];
subgraph cluster__1 { subgraph cluster__1 {
graph [bb="8,168,723,243", graph [bb="8,168,723,243",
label="theano.compile.builders.OpFromGraph object at 0x1076d9190", label="theano.compile.builders.OpFromGraph object at 0x114552bd0",
lheight=0.21, lheight=0.21,
lp="365.5,231.5", lp="365.5,231.5",
lwidth=4.90 lwidth=4.90
...@@ -32,7 +32,7 @@ digraph G { ...@@ -32,7 +32,7 @@ digraph G {
} }
subgraph cluster__5 { subgraph cluster__5 {
graph [bb="1759,168,2474,243", graph [bb="1759,168,2474,243",
label="theano.compile.builders.OpFromGraph object at 0x1076d9190 id=1", label="theano.compile.builders.OpFromGraph object at 0x114552bd0 id=1",
lheight=0.21, lheight=0.21,
lp="2116.5,231.5", lp="2116.5,231.5",
lwidth=5.31 lwidth=5.31
...@@ -60,7 +60,7 @@ digraph G { ...@@ -60,7 +60,7 @@ digraph G {
width=3.0556]; width=3.0556];
} }
_1 [height=0.5, _1 [height=0.5,
label="theano.compile.builders.OpFromGraph object at 0x1076d9190", label="theano.compile.builders.OpFromGraph object at 0x114552bd0",
pos="973,194", pos="973,194",
shape=ellipse, shape=ellipse,
width=6.6504]; width=6.6504];
...@@ -72,17 +72,17 @@ digraph G { ...@@ -72,17 +72,17 @@ digraph G {
style=filled, style=filled,
type=colored, type=colored,
width=2.6784]; width=2.6784];
_1 -> _9 [label="TensorType(float64, scalar)", _1 -> _9 [label="1 TensorType(float64, scalar)",
lp="1204,150", lp="1209.5,150",
pos="e,1185.8,122.05 1023.1,176.32 1067,161.66 1130.8,140.38 1176.2,125.28"]; pos="e,1185.8,122.05 1023.1,176.32 1067,161.66 1130.8,140.38 1176.2,125.28"];
_5 [height=0.5, _5 [height=0.5,
label="theano.compile.builders.OpFromGraph object at 0x1076d9190 id=1", label="theano.compile.builders.OpFromGraph object at 0x114552bd0 id=1",
pos="1490,194", pos="1490,194",
shape=ellipse, shape=ellipse,
width=7.1761]; width=7.1761];
_5 -> _9 [color=red, _5 -> _9 [color=red,
label="TensorType(float64, scalar)", label="0 TensorType(float64, scalar)",
lp="1461,150", lp="1466.5,150",
pos="e,1276.3,122.05 1439.8,176.32 1395.6,161.66 1331.5,140.38 1286,125.28"]; pos="e,1276.3,122.05 1439.8,176.32 1395.6,161.66 1331.5,140.38 1286,125.28"];
_10 [fillcolor=dodgerblue, _10 [fillcolor=dodgerblue,
height=0.5, height=0.5,
......
...@@ -301,10 +301,7 @@ function setupGraph() { ...@@ -301,10 +301,7 @@ function setupGraph() {
}); });
nodes.on('mouseover', function(node) { nodes.on('mouseover', function(node) {
if (!isProfiled || isEditNode || typeof(node.value.profile) == 'undefined') { // Highlight incoming edges
return;
}
edges.each(function (d, i) { edges.each(function (d, i) {
var edge = d3.select(this); var edge = d3.select(this);
if (d.source == node || d.target == node) { if (d.source == node || d.target == node) {
...@@ -313,13 +310,17 @@ function setupGraph() { ...@@ -313,13 +310,17 @@ function setupGraph() {
.style('opacity', 1.0); .style('opacity', 1.0);
} }
}); });
nodeDiv.transition()
.duration(200) // Show node details if node is not edited as has profiling information
.style('opacity', .9); if (!isEditNode && node.value.profile.length) {
nodeDiv nodeDiv.transition()
.html(nodeDetails(node)) .duration(200)
.style('left', (d3.event.pageX) + 30 + 'px') .style('opacity', .9);
.style('top', (d3.event.pageY - 28) + 'px'); nodeDiv
.html(nodeDetails(node))
.style('left', (d3.event.pageX) + 30 + 'px')
.style('top', (d3.event.pageY - 28) + 'px');
}
}); });
nodes.on('mouseout', function(node) { nodes.on('mouseout', function(node) {
......
digraph G { digraph G {
graph [bb="0,0,1448,251"]; graph [bb="0,0,1450,251"];
node [label="\N"]; node [label="\N"];
subgraph cluster__1 { subgraph cluster__1 {
graph [bb="8,168,723,243", graph [bb="8,168,723,243",
label="theano.compile.builders.OpFromGraph object at 0x107b5ca10", label="theano.compile.builders.OpFromGraph object at 0x114648450",
lheight=0.21, lheight=0.21,
lp="365.5,231.5", lp="365.5,231.5",
lwidth=4.88 lwidth=4.90
]; ];
_2 [fillcolor=limegreen, _2 [fillcolor=limegreen,
height=0.5, height=0.5,
...@@ -31,40 +31,40 @@ digraph G { ...@@ -31,40 +31,40 @@ digraph G {
width=3.0556]; width=3.0556];
} }
_1 [height=0.5, _1 [height=0.5,
label="theano.compile.builders.OpFromGraph object at 0x107b5ca10", label="theano.compile.builders.OpFromGraph object at 0x114648450",
pos="971,194", pos="972,194",
shape=ellipse, shape=ellipse,
width=6.6185]; width=6.6504];
_5 [fillcolor="#FFAABB", _5 [fillcolor="#FFAABB",
height=0.5, height=0.5,
label="Elemwise{Add}[(0, 0)]", label="Elemwise{Add}[(0, 0)]",
pos="1154,106", pos="1156,106",
shape=ellipse, shape=ellipse,
style=filled, style=filled,
type=colored, type=colored,
width=2.6784]; width=2.6784];
_1 -> _5 [color=red, _1 -> _5 [color=red,
label="TensorType(float64, scalar)", label="0 TensorType(float64, scalar)",
lp="1157,150", lp="1164.5,150",
pos="e,1120.1,122.94 1007.2,176.01 1036.9,162.04 1079.1,142.19 1110.7,127.37"]; pos="e,1121.9,122.94 1008.4,176.01 1038.4,161.97 1081.1,142.02 1112.8,127.18"];
_7 [fillcolor=dodgerblue, _7 [fillcolor=dodgerblue,
height=0.5, height=0.5,
label="TensorType(float64, scalar) id=4", label="TensorType(float64, scalar) id=4",
pos="1154,18", pos="1156,18",
shape=box, shape=box,
style=filled, style=filled,
width=2.7847]; width=2.7847];
_5 -> _7 [label="TensorType(float64, scalar)", _5 -> _7 [label="TensorType(float64, scalar)",
lp="1232,62", lp="1234,62",
pos="e,1154,36.084 1154,87.597 1154,75.746 1154,59.817 1154,46.292"]; pos="e,1156,36.084 1156,87.597 1156,75.746 1156,59.817 1156,46.292"];
_6 [fillcolor=limegreen, _6 [fillcolor=limegreen,
height=0.5, height=0.5,
label="name=z TensorType(float64, scalar)", label="name=z TensorType(float64, scalar)",
pos="1338,194", pos="1340,194",
shape=box, shape=box,
style=filled, style=filled,
width=3.0556]; width=3.0556];
_6 -> _5 [label="TensorType(float64, scalar)", _6 -> _5 [label="1 TensorType(float64, scalar)",
lp="1347,150", lp="1364.5,150",
pos="e,1193.7,122.51 1306.2,175.76 1287,165.54 1261.8,152.55 1239,142 1227.5,136.66 1214.9,131.25 1203,126.34"]; pos="e,1202.1,121.95 1313.3,175.88 1296.2,165.33 1273.3,151.95 1252,142 1239.2,136.01 1225.1,130.36 1211.7,125.42"];
} }
...@@ -155,12 +155,13 @@ class GraphFormatter(object): ...@@ -155,12 +155,13 @@ class GraphFormatter(object):
param['color'] = 'red' param['color'] = 'red'
edge_label = str(var.type) edge_label = str(var.type)
if len(node.inputs) > 1:
edge_label = str(id) + ' ' + edge_label
if var.owner is None: if var.owner is None:
id_ = self.var_name(var) id_ = self.var_name(var)
n = make_node(id_, n = make_node(id_, style='filled',
style='filled', fillcolor=self.node_colors['input'],
fillcolor=self.node_colors['input'], shape=var_shape, profile=aprof)
shape=var_shape, profile=aprof)
parent.add_node(n) parent.add_node(n)
if not is_opfrom: if not is_opfrom:
g.add_edge(pd.Edge(n.get_name(), aid, label=edge_label, **param)) g.add_edge(pd.Edge(n.get_name(), aid, label=edge_label, **param))
......
...@@ -301,10 +301,7 @@ function setupGraph() { ...@@ -301,10 +301,7 @@ function setupGraph() {
}); });
nodes.on('mouseover', function(node) { nodes.on('mouseover', function(node) {
if (!isProfiled || isEditNode || typeof(node.value.profile) == 'undefined') { // Highlight incoming edges
return;
}
edges.each(function (d, i) { edges.each(function (d, i) {
var edge = d3.select(this); var edge = d3.select(this);
if (d.source == node || d.target == node) { if (d.source == node || d.target == node) {
...@@ -313,13 +310,17 @@ function setupGraph() { ...@@ -313,13 +310,17 @@ function setupGraph() {
.style('opacity', 1.0); .style('opacity', 1.0);
} }
}); });
nodeDiv.transition()
.duration(200) // Show node details if node is not edited as has profiling information
.style('opacity', .9); if (!isEditNode && node.value.profile.length) {
nodeDiv nodeDiv.transition()
.html(nodeDetails(node)) .duration(200)
.style('left', (d3.event.pageX) + 30 + 'px') .style('opacity', .9);
.style('top', (d3.event.pageY - 28) + 'px'); nodeDiv
.html(nodeDetails(node))
.style('left', (d3.event.pageX) + 30 + 'px')
.style('top', (d3.event.pageY - 28) + 'px');
}
}); });
nodes.on('mouseout', function(node) { nodes.on('mouseout', function(node) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论