Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
d5c089f5
提交
d5c089f5
authored
7月 29, 2015
作者:
Christof Angermueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix lost edge highlight feature
上级
39adc822
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
772 行增加
和
135 行删除
+772
-135
d3theano.js
doc/d3printing/GSoC/150724_opfrom/dev/d3theano.js
+12
-11
dev.ipynb
doc/d3printing/GSoC/150724_opfrom/dev/dev.ipynb
+387
-0
opfrom.dot
doc/d3printing/GSoC/150724_opfrom/dev/opfrom.dot
+26
-26
d3theano.js
doc/d3printing/GSoC/150724_opfrom/example1/d3theano.js
+12
-11
index.dot
doc/d3printing/GSoC/150724_opfrom/example1/index.dot
+8
-8
d3theano.js
doc/d3printing/GSoC/150724_opfrom/example2/d3theano.js
+12
-11
index.dot
doc/d3printing/GSoC/150724_opfrom/example2/index.dot
+17
-17
index.ipynb
doc/d3printing/GSoC/150724_opfrom/index.ipynb
+281
-36
formatting.py
theano/d3printing/formatting.py
+5
-4
d3theano.js
theano/d3printing/javascript/d3theano.js
+12
-11
没有找到文件。
doc/d3printing/GSoC/150724_opfrom/dev/d3theano.js
浏览文件 @
d5c089f5
...
@@ -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
)
{
...
...
doc/d3printing/GSoC/150724_opfrom/dev/dev.ipynb
0 → 100644
浏览文件 @
d5c089f5
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import numpy as np\n",
"from IPython.display import SVG"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"%load_ext autoreload\n",
"%autoreload 2"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Couldn't import dot_parser, loading of dot files will not be possible.\n"
]
}
],
"source": [
"import theano as th\n",
"import theano.tensor as tht\n",
"import theano.printing as thp\n",
"import theano.d3printing as d3p"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Example 1"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"x, y, z = tht.scalars('xyz')\n",
"e = x + y * z\n",
"o = th.OpFromGraph([x, y, z], [e])\n",
"e2 = o(x, y, z) + o(z, y, y)\n",
"f = th.function([x, y, z], [e2])"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"topo = f.maker.fgraph.toposort()"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"of = topo[0]"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"fo = of.op.fn"
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"gf = d3p.GraphFormatter()\n",
"g = gf.to_pydot(fo)"
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/svg+xml": [
"<svg height=\"220pt\" viewBox=\"0.00 0.00 722.00 220.00\" width=\"722pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(1 1) rotate(0) translate(4 216)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" points=\"-4,4 -4,-216 718,-216 718,4 -4,4\" stroke=\"none\"/>\n",
"<!-- _1 -->\n",
"<g class=\"node\" id=\"node1\"><title>_1</title>\n",
"<ellipse cx=\"349\" cy=\"-106\" fill=\"#ffaabb\" rx=\"155.005\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"349\" y=\"-102.3\">Elemwise{Composite{(i0 + (i1 * i2))}}</text>\n",
"</g>\n",
"<!-- _5 -->\n",
"<g class=\"node\" id=\"node5\"><title>_5</title>\n",
"<polygon fill=\"dodgerblue\" points=\"435,-36 263,-36 263,-0 435,-0 435,-36\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"349\" y=\"-14.3\">TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _1->_5 -->\n",
"<g class=\"edge\" id=\"edge4\"><title>_1->_5</title>\n",
"<path d=\"M349,-87.5966C349,-75.7459 349,-59.8169 349,-46.2917\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"352.5,-46.084 349,-36.084 345.5,-46.084 352.5,-46.084\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"427\" y=\"-58.3\">TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _2 -->\n",
"<g class=\"node\" id=\"node2\"><title>_2</title>\n",
"<polygon fill=\"limegreen\" points=\"220.25,-212 -0.25,-212 -0.25,-176 220.25,-176 220.25,-212\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"110\" y=\"-190.3\">name=x TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _2->_1 -->\n",
"<g class=\"edge\" id=\"edge1\"><title>_2->_1</title>\n",
"<path d=\"M128.186,-175.807C141.119,-164.521 159.428,-150.354 178,-142 197.086,-133.415 218.319,-126.915 239.152,-121.999\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"240.022,-125.391 249.01,-119.781 238.486,-118.562 240.022,-125.391\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"261.5\" y=\"-146.3\">0 TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _3 -->\n",
"<g class=\"node\" id=\"node3\"><title>_3</title>\n",
"<polygon fill=\"limegreen\" points=\"459.25,-212 238.75,-212 238.75,-176 459.25,-176 459.25,-212\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"349\" y=\"-190.3\">name=y TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _3->_1 -->\n",
"<g class=\"edge\" id=\"edge2\"><title>_3->_1</title>\n",
"<path d=\"M349,-175.597C349,-163.746 349,-147.817 349,-134.292\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"352.5,-134.084 349,-124.084 345.5,-134.084 352.5,-134.084\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"432.5\" y=\"-146.3\">1 TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _4 -->\n",
"<g class=\"node\" id=\"node4\"><title>_4</title>\n",
"<polygon fill=\"limegreen\" points=\"698,-212 478,-212 478,-176 698,-176 698,-212\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"588\" y=\"-190.3\">name=z TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _4->_1 -->\n",
"<g class=\"edge\" id=\"edge3\"><title>_4->_1</title>\n",
"<path d=\"M569.814,-175.807C556.881,-164.521 538.572,-150.354 520,-142 500.914,-133.415 479.681,-126.915 458.848,-121.999\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"459.514,-118.562 448.99,-119.781 457.978,-125.391 459.514,-118.562\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"630.5\" y=\"-146.3\">2 TensorType(float64, scalar)</text>\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 48,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"SVG(g.create_svg())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Example 2 "
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"x, y, z = tht.scalars('xyz')\n",
"e = x * y\n",
"o = th.OpFromGraph([x, y], [e])\n",
"e2 = o(x, y) + z\n",
"o2 = th.OpFromGraph([x, y, z], [e2])\n",
"e3 = o2(x, y, z) + z\n",
"f = th.function([x, y, z], [e3])"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"topo = f.maker.fgraph.toposort()"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"of = topo[0]"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"ofo = of.op"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"gf = d3p.GraphFormatter()"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"g = gf.to_pydot(ofo.fn.maker.fgraph)"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/svg+xml": [
"<svg height=\"259pt\" viewBox=\"0.00 0.00 1212.00 259.00\" width=\"1212pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(1 1) rotate(0) translate(4 255)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" points=\"-4,4 -4,-255 1208,-255 1208,4 -4,4\" stroke=\"none\"/>\n",
"<g class=\"cluster\" id=\"clust1\"><title>cluster__1</title>\n",
"<polygon fill=\"none\" points=\"8,-168 8,-243 485,-243 485,-168 8,-168\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"246.5\" y=\"-227.8\">theano.compile.builders.OpFromGraph object at 0x10eff0410</text>\n",
"</g>\n",
"<!-- _2 -->\n",
"<g class=\"node\" id=\"node1\"><title>_2</title>\n",
"<polygon fill=\"limegreen\" points=\"476.25,-212 255.75,-212 255.75,-176 476.25,-176 476.25,-212\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"366\" y=\"-190.3\">name=x TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _3 -->\n",
"<g class=\"node\" id=\"node2\"><title>_3</title>\n",
"<polygon fill=\"limegreen\" points=\"237.25,-212 16.75,-212 16.75,-176 237.25,-176 237.25,-212\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"127\" y=\"-190.3\">name=y TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _1 -->\n",
"<g class=\"node\" id=\"node3\"><title>_1</title>\n",
"<ellipse cx=\"730\" cy=\"-194\" fill=\"none\" rx=\"235.394\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"730\" y=\"-190.3\">theano.compile.builders.OpFromGraph object at 0x10eff0410</text>\n",
"</g>\n",
"<!-- _4 -->\n",
"<g class=\"node\" id=\"node4\"><title>_4</title>\n",
"<ellipse cx=\"912\" cy=\"-106\" fill=\"#ffaabb\" rx=\"96.2631\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"912\" y=\"-102.3\">Elemwise{Add}[(0, 0)]</text>\n",
"</g>\n",
"<!-- _1->_4 -->\n",
"<g class=\"edge\" id=\"edge1\"><title>_1->_4</title>\n",
"<path d=\"M765.957,-176.009C795.53,-162.035 837.526,-142.191 868.899,-127.367\" fill=\"none\" stroke=\"red\"/>\n",
"<polygon fill=\"red\" points=\"870.722,-130.376 878.269,-122.939 867.732,-124.047 870.722,-130.376\" stroke=\"red\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"921.5\" y=\"-146.3\">0 TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _6 -->\n",
"<g class=\"node\" id=\"node6\"><title>_6</title>\n",
"<polygon fill=\"dodgerblue\" points=\"1012.25,-36 811.75,-36 811.75,-0 1012.25,-0 1012.25,-36\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"912\" y=\"-14.3\">TensorType(float64, scalar) id=4</text>\n",
"</g>\n",
"<!-- _4->_6 -->\n",
"<g class=\"edge\" id=\"edge3\"><title>_4->_6</title>\n",
"<path d=\"M912,-87.5966C912,-75.7459 912,-59.8169 912,-46.2917\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"915.5,-46.084 912,-36.084 908.5,-46.084 915.5,-46.084\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"990\" y=\"-58.3\">TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _5 -->\n",
"<g class=\"node\" id=\"node5\"><title>_5</title>\n",
"<polygon fill=\"limegreen\" points=\"1204,-212 984,-212 984,-176 1204,-176 1204,-212\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"1094\" y=\"-190.3\">name=z TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _5->_4 -->\n",
"<g class=\"edge\" id=\"edge2\"><title>_5->_4</title>\n",
"<path d=\"M1068.31,-175.793C1051.81,-165.201 1029.68,-151.818 1009,-142 996.117,-135.882 981.858,-130.182 968.328,-125.233\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"969.23,-121.838 958.635,-121.767 966.873,-128.43 969.23,-121.838\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"1120.5\" y=\"-146.3\">1 TensorType(float64, scalar)</text>\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"SVG(g.create_svg())"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.10"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
doc/d3printing/GSoC/150724_opfrom/dev/opfrom.dot
浏览文件 @
d5c089f5
digraph
G
{
digraph
G
{
graph
[
bb
=
"0,0,24
82
,251"
]
;
graph
[
bb
=
"0,0,24
78
,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 0x1
076d919
0"
,
label
=
"theano.compile.builders.OpFromGraph object at 0x1
141d3a5
0"
,
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
=
"175
9,168,2474
,243"
,
graph
[
bb
=
"175
5,168,2470
,243"
,
label
=
"theano.compile.builders.OpFromGraph object at 0x1
076d919
0 id=1"
,
label
=
"theano.compile.builders.OpFromGraph object at 0x1
141d3a5
0 id=1"
,
lheight
=
0.21
,
lheight
=
0.21
,
lp
=
"211
6
.5,231.5"
,
lp
=
"211
2
.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
=
"235
5
,194"
,
pos
=
"235
1
,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
=
"211
6
,194"
,
pos
=
"211
2
,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
=
"187
7
,194"
,
pos
=
"187
3
,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 0x1
076d919
0"
,
label
=
"theano.compile.builders.OpFromGraph object at 0x1
141d3a5
0"
,
pos
=
"97
3
,194"
,
pos
=
"97
2
,194"
,
shape
=
ellipse
,
shape
=
ellipse
,
width
=
6.6
50
4
]
;
width
=
6.6
41
4
]
;
_
9
[
fillcolor
=
"#FFAABB"
,
_
9
[
fillcolor
=
"#FFAABB"
,
height
=
0.5
,
height
=
0.5
,
label
=
"Elemwise{Add}[(0, 0)]"
,
label
=
"Elemwise{Add}[(0, 0)]"
,
pos
=
"12
31
,106"
,
pos
=
"12
29
,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
=
"120
4
,150"
,
lp
=
"120
7.5
,150"
,
pos
=
"e,118
5.8,122.05 1023.1,176.32 1067,161.66 1130.8,140.38 1176.2
,125.28"
]
;
pos
=
"e,118
4,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 0x1
076d919
0 id=1"
,
label
=
"theano.compile.builders.OpFromGraph object at 0x1
141d3a5
0 id=1"
,
pos
=
"14
90
,194"
,
pos
=
"14
87
,194"
,
shape
=
ellipse
,
shape
=
ellipse
,
width
=
7.1
761
]
;
width
=
7.1
67
]
;
_
5
->
_
9
[
color
=
red
,
_
5
->
_
9
[
color
=
red
,
label
=
"TensorType(float64, scalar)"
,
label
=
"
0
TensorType(float64, scalar)"
,
lp
=
"146
1
,150"
,
lp
=
"146
4.5
,150"
,
pos
=
"e,127
6.3,122.05 1439.8,176.32 1395.6,161.66 1331.5,140.38 1286
,125.28"
]
;
pos
=
"e,127
4.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
=
"12
31
,18"
,
pos
=
"12
29
,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
=
"130
9
,62"
,
lp
=
"130
7
,62"
,
pos
=
"e,12
31,36.084 1231,87.597 1231,75.746 1231,59.817 1231
,46.292"
]
;
pos
=
"e,12
29,36.084 1229,87.597 1229,75.746 1229,59.817 1229
,46.292"
]
;
}
}
doc/d3printing/GSoC/150724_opfrom/example1/d3theano.js
浏览文件 @
d5c089f5
...
@@ -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
)
{
...
...
doc/d3printing/GSoC/150724_opfrom/example1/index.dot
浏览文件 @
d5c089f5
...
@@ -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 0x1
076d919
0"
,
label
=
"theano.compile.builders.OpFromGraph object at 0x1
14552bd
0"
,
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 0x1
076d919
0 id=1"
,
label
=
"theano.compile.builders.OpFromGraph object at 0x1
14552bd
0 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 0x1
076d919
0"
,
label
=
"theano.compile.builders.OpFromGraph object at 0x1
14552bd
0"
,
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
=
"120
4
,150"
,
lp
=
"120
9.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 0x1
076d919
0 id=1"
,
label
=
"theano.compile.builders.OpFromGraph object at 0x1
14552bd
0 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
=
"146
1
,150"
,
lp
=
"146
6.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
,
...
...
doc/d3printing/GSoC/150724_opfrom/example2/d3theano.js
浏览文件 @
d5c089f5
...
@@ -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
)
{
...
...
doc/d3printing/GSoC/150724_opfrom/example2/index.dot
浏览文件 @
d5c089f5
digraph
G
{
digraph
G
{
graph
[
bb
=
"0,0,14
48
,251"
]
;
graph
[
bb
=
"0,0,14
50
,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 0x1
07b5ca1
0"
,
label
=
"theano.compile.builders.OpFromGraph object at 0x1
1464845
0"
,
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 0x1
07b5ca1
0"
,
label
=
"theano.compile.builders.OpFromGraph object at 0x1
1464845
0"
,
pos
=
"97
1
,194"
,
pos
=
"97
2
,194"
,
shape
=
ellipse
,
shape
=
ellipse
,
width
=
6.6
185
]
;
width
=
6.6
504
]
;
_
5
[
fillcolor
=
"#FFAABB"
,
_
5
[
fillcolor
=
"#FFAABB"
,
height
=
0.5
,
height
=
0.5
,
label
=
"Elemwise{Add}[(0, 0)]"
,
label
=
"Elemwise{Add}[(0, 0)]"
,
pos
=
"115
4
,106"
,
pos
=
"115
6
,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
=
"11
57
,150"
,
lp
=
"11
64.5
,150"
,
pos
=
"e,112
0.1,122.94 1007.2,176.01 1036.9,162.04 1079.1,142.19 1110.7,127.37
"
]
;
pos
=
"e,112
1.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
=
"115
4
,18"
,
pos
=
"115
6
,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
=
"123
2
,62"
,
lp
=
"123
4
,62"
,
pos
=
"e,115
4,36.084 1154,87.597 1154,75.746 1154,59.817 1154
,46.292"
]
;
pos
=
"e,115
6,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
=
"13
38
,194"
,
pos
=
"13
40
,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
=
"13
47
,150"
,
lp
=
"13
64.5
,150"
,
pos
=
"e,1
193.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,1
202.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
"
]
;
}
}
doc/d3printing/GSoC/150724_opfrom/index.ipynb
浏览文件 @
d5c089f5
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
"cells": [
"cells": [
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
1
,
"execution_count":
8
,
"metadata": {
"metadata": {
"collapsed": true
"collapsed": true
},
},
...
@@ -14,11 +14,20 @@
...
@@ -14,11 +14,20 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
2
,
"execution_count":
9
,
"metadata": {
"metadata": {
"collapsed": false
"collapsed": false
},
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The autoreload extension is already loaded. To reload it, use:\n",
" %reload_ext autoreload\n"
]
}
],
"source": [
"source": [
"%load_ext autoreload\n",
"%load_ext autoreload\n",
"%autoreload 2"
"%autoreload 2"
...
@@ -26,19 +35,11 @@
...
@@ -26,19 +35,11 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
3
,
"execution_count":
10
,
"metadata": {
"metadata": {
"collapsed": false
"collapsed": false
},
},
"outputs": [
"outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"Couldn't import dot_parser, loading of dot files will not be possible.\n"
]
}
],
"source": [
"source": [
"import theano as th\n",
"import theano as th\n",
"import theano.tensor as tht\n",
"import theano.tensor as tht\n",
...
@@ -46,6 +47,21 @@
...
@@ -46,6 +47,21 @@
"import theano.d3printing as d3p"
"import theano.d3printing as d3p"
]
]
},
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def viz_ofg(ofg):\n",
" fo = ofg.op.fn\n",
" gf = d3p.GraphFormatter()\n",
" g = gf.to_pydot(fo)\n",
" return g.create_svg()"
]
},
{
{
"cell_type": "markdown",
"cell_type": "markdown",
"metadata": {},
"metadata": {},
...
@@ -55,7 +71,7 @@
...
@@ -55,7 +71,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
4
,
"execution_count":
31
,
"metadata": {
"metadata": {
"collapsed": false
"collapsed": false
},
},
...
@@ -70,43 +86,106 @@
...
@@ -70,43 +86,106 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
5
,
"execution_count":
12
,
"metadata": {
"metadata": {
"collapsed": false
"collapsed": false
},
},
"outputs": [],
"outputs": [],
"source": [
"source": [
"gf = d3p.GraphFormatter()\n",
"d3p.d3print(f, 'example1/index.html')"
"g = gf.to_pydot(f)"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "markdown",
"execution_count": 6,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"source": [
"
g.write_dot('dev/opfrom.dot');
"
"
[Open](./example1/index.html)
"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "markdown",
"execution_count": 7,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"source": [
"
d3p.d3print(f, 'example1/index.html')
"
"
## OFG node
"
]
]
},
},
{
{
"cell_type": "markdown",
"cell_type": "code",
"metadata": {},
"execution_count": 33,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/svg+xml": [
"<svg height=\"220pt\" viewBox=\"0.00 0.00 722.00 220.00\" width=\"722pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(1 1) rotate(0) translate(4 216)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" points=\"-4,4 -4,-216 718,-216 718,4 -4,4\" stroke=\"none\"/>\n",
"<!-- _1 -->\n",
"<g class=\"node\" id=\"node1\"><title>_1</title>\n",
"<ellipse cx=\"349\" cy=\"-106\" fill=\"#ffaabb\" rx=\"155.005\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"349\" y=\"-102.3\">Elemwise{Composite{(i0 + (i1 * i2))}}</text>\n",
"</g>\n",
"<!-- _5 -->\n",
"<g class=\"node\" id=\"node5\"><title>_5</title>\n",
"<polygon fill=\"dodgerblue\" points=\"435,-36 263,-36 263,-0 435,-0 435,-36\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"349\" y=\"-14.3\">TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _1->_5 -->\n",
"<g class=\"edge\" id=\"edge4\"><title>_1->_5</title>\n",
"<path d=\"M349,-87.5966C349,-75.7459 349,-59.8169 349,-46.2917\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"352.5,-46.084 349,-36.084 345.5,-46.084 352.5,-46.084\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"427\" y=\"-58.3\">TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _2 -->\n",
"<g class=\"node\" id=\"node2\"><title>_2</title>\n",
"<polygon fill=\"limegreen\" points=\"220.25,-212 -0.25,-212 -0.25,-176 220.25,-176 220.25,-212\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"110\" y=\"-190.3\">name=x TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _2->_1 -->\n",
"<g class=\"edge\" id=\"edge1\"><title>_2->_1</title>\n",
"<path d=\"M128.186,-175.807C141.119,-164.521 159.428,-150.354 178,-142 197.086,-133.415 218.319,-126.915 239.152,-121.999\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"240.022,-125.391 249.01,-119.781 238.486,-118.562 240.022,-125.391\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"261.5\" y=\"-146.3\">0 TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _3 -->\n",
"<g class=\"node\" id=\"node3\"><title>_3</title>\n",
"<polygon fill=\"limegreen\" points=\"459.25,-212 238.75,-212 238.75,-176 459.25,-176 459.25,-212\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"349\" y=\"-190.3\">name=y TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _3->_1 -->\n",
"<g class=\"edge\" id=\"edge2\"><title>_3->_1</title>\n",
"<path d=\"M349,-175.597C349,-163.746 349,-147.817 349,-134.292\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"352.5,-134.084 349,-124.084 345.5,-134.084 352.5,-134.084\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"432.5\" y=\"-146.3\">1 TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _4 -->\n",
"<g class=\"node\" id=\"node4\"><title>_4</title>\n",
"<polygon fill=\"limegreen\" points=\"698,-212 478,-212 478,-176 698,-176 698,-212\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"588\" y=\"-190.3\">name=z TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _4->_1 -->\n",
"<g class=\"edge\" id=\"edge3\"><title>_4->_1</title>\n",
"<path d=\"M569.814,-175.807C556.881,-164.521 538.572,-150.354 520,-142 500.914,-133.415 479.681,-126.915 458.848,-121.999\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"459.514,-118.562 448.99,-119.781 457.978,-125.391 459.514,-118.562\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"630.5\" y=\"-146.3\">2 TensorType(float64, scalar)</text>\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"source": [
"
[Open](./example1/index.html
)"
"
SVG(viz_ofg(f.maker.fgraph.toposort()[0])
)"
]
]
},
},
{
{
...
@@ -118,7 +197,7 @@
...
@@ -118,7 +197,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
8
,
"execution_count":
42
,
"metadata": {
"metadata": {
"collapsed": false
"collapsed": false
},
},
...
@@ -135,7 +214,7 @@
...
@@ -135,7 +214,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
9
,
"execution_count":
21
,
"metadata": {
"metadata": {
"collapsed": false
"collapsed": false
},
},
...
@@ -150,6 +229,172 @@
...
@@ -150,6 +229,172 @@
"source": [
"source": [
"[Open](./example2/index.html)"
"[Open](./example2/index.html)"
]
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## OFG node 1 "
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/svg+xml": [
"<svg height=\"259pt\" viewBox=\"0.00 0.00 1219.00 259.00\" width=\"1219pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(1 1) rotate(0) translate(4 255)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" points=\"-4,4 -4,-255 1215,-255 1215,4 -4,4\" stroke=\"none\"/>\n",
"<g class=\"cluster\" id=\"clust1\"><title>cluster__1</title>\n",
"<polygon fill=\"none\" points=\"8,-168 8,-243 485,-243 485,-168 8,-168\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"246.5\" y=\"-227.8\">theano.compile.builders.OpFromGraph object at 0x1148a8110</text>\n",
"</g>\n",
"<!-- _2 -->\n",
"<g class=\"node\" id=\"node1\"><title>_2</title>\n",
"<polygon fill=\"limegreen\" points=\"476.25,-212 255.75,-212 255.75,-176 476.25,-176 476.25,-212\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"366\" y=\"-190.3\">name=x TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _3 -->\n",
"<g class=\"node\" id=\"node2\"><title>_3</title>\n",
"<polygon fill=\"limegreen\" points=\"237.25,-212 16.75,-212 16.75,-176 237.25,-176 237.25,-212\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"127\" y=\"-190.3\">name=y TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _1 -->\n",
"<g class=\"node\" id=\"node3\"><title>_1</title>\n",
"<ellipse cx=\"734\" cy=\"-194\" fill=\"none\" rx=\"239.268\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"734\" y=\"-190.3\">theano.compile.builders.OpFromGraph object at 0x1148a8110</text>\n",
"</g>\n",
"<!-- _4 -->\n",
"<g class=\"node\" id=\"node4\"><title>_4</title>\n",
"<ellipse cx=\"917\" cy=\"-106\" fill=\"#ffaabb\" rx=\"96.2631\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"917\" y=\"-102.3\">Elemwise{Add}[(0, 0)]</text>\n",
"</g>\n",
"<!-- _1->_4 -->\n",
"<g class=\"edge\" id=\"edge1\"><title>_1->_4</title>\n",
"<path d=\"M770.155,-176.009C799.89,-162.035 842.117,-142.191 873.662,-127.367\" fill=\"none\" stroke=\"red\"/>\n",
"<polygon fill=\"red\" points=\"875.521,-130.36 883.083,-122.939 872.544,-124.025 875.521,-130.36\" stroke=\"red\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"925.5\" y=\"-146.3\">0 TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _6 -->\n",
"<g class=\"node\" id=\"node6\"><title>_6</title>\n",
"<polygon fill=\"dodgerblue\" points=\"1017.25,-36 816.75,-36 816.75,-0 1017.25,-0 1017.25,-36\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"917\" y=\"-14.3\">TensorType(float64, scalar) id=4</text>\n",
"</g>\n",
"<!-- _4->_6 -->\n",
"<g class=\"edge\" id=\"edge3\"><title>_4->_6</title>\n",
"<path d=\"M917,-87.5966C917,-75.7459 917,-59.8169 917,-46.2917\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"920.5,-46.084 917,-36.084 913.5,-46.084 920.5,-46.084\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"995\" y=\"-58.3\">TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _5 -->\n",
"<g class=\"node\" id=\"node5\"><title>_5</title>\n",
"<polygon fill=\"limegreen\" points=\"1211,-212 991,-212 991,-176 1211,-176 1211,-212\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"1101\" y=\"-190.3\">name=z TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _5->_4 -->\n",
"<g class=\"edge\" id=\"edge2\"><title>_5->_4</title>\n",
"<path d=\"M1074.31,-175.883C1057.2,-165.325 1034.27,-151.949 1013,-142 1000.2,-136.013 986.068,-130.363 972.675,-125.42\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"973.677,-122.061 963.083,-121.951 971.296,-128.644 973.677,-122.061\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"1125.5\" y=\"-146.3\">1 TensorType(float64, scalar)</text>\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ofg1 = f.maker.fgraph.toposort()[0]\n",
"SVG(viz_ofg(ofg1))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## OFG node 2"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/svg+xml": [
"<svg height=\"220pt\" viewBox=\"0.00 0.00 513.00 220.00\" width=\"513pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(1 1) rotate(0) translate(4 216)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" points=\"-4,4 -4,-216 509,-216 509,4 -4,4\" stroke=\"none\"/>\n",
"<!-- _1 -->\n",
"<g class=\"node\" id=\"node1\"><title>_1</title>\n",
"<ellipse cx=\"229\" cy=\"-106\" fill=\"#ffaabb\" rx=\"111.186\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"229\" y=\"-102.3\">Elemwise{mul,no_inplace}</text>\n",
"</g>\n",
"<!-- _4 -->\n",
"<g class=\"node\" id=\"node4\"><title>_4</title>\n",
"<polygon fill=\"dodgerblue\" points=\"315,-36 143,-36 143,-0 315,-0 315,-36\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"229\" y=\"-14.3\">TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _1->_4 -->\n",
"<g class=\"edge\" id=\"edge3\"><title>_1->_4</title>\n",
"<path d=\"M229,-87.5966C229,-75.7459 229,-59.8169 229,-46.2917\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"232.5,-46.084 229,-36.084 225.5,-46.084 232.5,-46.084\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"307\" y=\"-58.3\">TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _2 -->\n",
"<g class=\"node\" id=\"node2\"><title>_2</title>\n",
"<polygon fill=\"limegreen\" points=\"220.25,-212 -0.25,-212 -0.25,-176 220.25,-176 220.25,-212\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"110\" y=\"-190.3\">name=x TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _2->_1 -->\n",
"<g class=\"edge\" id=\"edge1\"><title>_2->_1</title>\n",
"<path d=\"M124.112,-175.983C133.526,-165.334 146.597,-151.821 160,-142 167.085,-136.809 175.052,-131.986 182.989,-127.682\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"184.633,-130.772 191.889,-123.051 181.402,-124.562 184.633,-130.772\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"243.5\" y=\"-146.3\">0 TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _3 -->\n",
"<g class=\"node\" id=\"node3\"><title>_3</title>\n",
"<polygon fill=\"limegreen\" points=\"459.25,-212 238.75,-212 238.75,-176 459.25,-176 459.25,-212\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"349\" y=\"-190.3\">name=y TensorType(float64, scalar)</text>\n",
"</g>\n",
"<!-- _3->_1 -->\n",
"<g class=\"edge\" id=\"edge2\"><title>_3->_1</title>\n",
"<path d=\"M345.336,-175.801C342.177,-164.804 336.566,-150.971 327,-142 319.637,-135.095 310.819,-129.537 301.533,-125.066\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"302.691,-121.753 292.126,-120.949 299.884,-128.165 302.691,-121.753\" stroke=\"black\"/>\n",
"<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"421.5\" y=\"-146.3\">1 TensorType(float64, scalar)</text>\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ofg2 = ofg1.op.fn.maker.fgraph.toposort()[0]\n",
"SVG(viz_ofg(ofg2))"
]
}
}
],
],
"metadata": {
"metadata": {
...
...
theano/d3printing/formatting.py
浏览文件 @
d5c089f5
...
@@ -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
))
...
...
theano/d3printing/javascript/d3theano.js
浏览文件 @
d5c089f5
...
@@ -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
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论