Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
d8b8a536
提交
d8b8a536
authored
8月 24, 2015
作者:
Christof Angermueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Copy dependecies to output directory by default
上级
a6635704
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
21 行增加
和
10 行删除
+21
-10
d3viz.py
theano/d3viz/d3viz.py
+17
-6
template.html
theano/d3viz/html/template.html
+4
-4
没有找到文件。
theano/d3viz/d3viz.py
浏览文件 @
d8b8a536
...
@@ -5,6 +5,7 @@ Author: Christof Angermueller <cangermueller@gmail.com>
...
@@ -5,6 +5,7 @@ Author: Christof Angermueller <cangermueller@gmail.com>
import
os
import
os
import
os.path
as
pt
import
os.path
as
pt
import
shutil
from
formatting
import
PyDotFormatter
from
formatting
import
PyDotFormatter
...
@@ -25,14 +26,14 @@ def d3write(fct, path, *args, **kwargs):
...
@@ -25,14 +26,14 @@ def d3write(fct, path, *args, **kwargs):
g
.
write_dot
(
path
)
g
.
write_dot
(
path
)
def
d3viz
(
fct
,
outfile
,
*
args
,
**
kwargs
):
def
d3viz
(
fct
,
outfile
,
copy_deps
=
True
,
*
args
,
**
kwargs
):
"""Create HTML file with dynamic visualizing of a Theano function graph.
"""Create HTML file with dynamic visualizing of a Theano function graph.
:param fct: A compiled Theano function, variable, apply or a list of
:param fct: A compiled Theano function, variable, apply or a list of
variables.
variables.
:param outfile: The output HTML file
:param outfile: The output HTML file
.
:param co
mpact=False: if True, will remove intermediate variables without
:param co
py_deps: Copy javascript and CSS dependencies to output directory.
name
.
:param *args, **kwargs: Arguments passed to PyDotFormatter
.
In the HTML file, the whole graph or single nodes can be moved by drag and
In the HTML file, the whole graph or single nodes can be moved by drag and
drop. Zooming is possible via the mouse wheel. Detailed information about
drop. Zooming is possible via the mouse wheel. Detailed information about
...
@@ -63,10 +64,20 @@ def d3viz(fct, outfile, *args, **kwargs):
...
@@ -63,10 +64,20 @@ def d3viz(fct, outfile, *args, **kwargs):
template
=
f
.
read
()
template
=
f
.
read
()
f
.
close
()
f
.
close
()
src_deps
=
__path__
if
copy_deps
:
dst_deps
=
'd3viz'
for
d
in
[
'js'
,
'css'
]:
dep
=
pt
.
join
(
outdir
,
dst_deps
,
d
)
if
not
pt
.
exists
(
dep
):
shutil
.
copytree
(
pt
.
join
(
src_deps
,
d
),
dep
)
else
:
dst_deps
=
src_deps
# Replace patterns in template
# Replace patterns in template
replace
=
{
replace
=
{
'
%%
JS_DIR
%%
'
:
pt
.
join
(
__path__
,
'js'
),
'
%%
JS_DIR
%%
'
:
pt
.
join
(
dst_deps
,
'js'
),
'
%%
CSS_DIR
%%
'
:
pt
.
join
(
__path__
,
'css'
),
'
%%
CSS_DIR
%%
'
:
pt
.
join
(
dst_deps
,
'css'
),
'
%%
DOT_FILE
%%
'
:
pt
.
basename
(
dot_file
),
'
%%
DOT_FILE
%%
'
:
pt
.
basename
(
dot_file
),
}
}
html
=
replace_patterns
(
template
,
replace
)
html
=
replace_patterns
(
template
,
replace
)
...
...
theano/d3viz/html/template.html
浏览文件 @
d8b8a536
...
@@ -3,11 +3,11 @@
...
@@ -3,11 +3,11 @@
<head>
<head>
<link
rel=
"stylesheet"
href=
"%% CSS_DIR %%/d3viz.css"
/>
<link
rel=
"stylesheet"
href=
"%% CSS_DIR %%/d3viz.css"
/>
<link
rel=
"stylesheet"
href=
"%% CSS_DIR %%/d3-context-menu.css"
/>
<link
rel=
"stylesheet"
href=
"%% CSS_DIR %%/d3-context-menu.css"
/>
<script
type=
'text/javascript'
src=
"%% JS_DIR %%/d3viz.js"
></script>
<script
type=
"text/javascript"
src=
"%% JS_DIR %%/d3viz.js"
></script>
<script
type=
"text/javascript"
src=
"%% JS_DIR %%/d3.v3.min.js"
></script>
<script
type=
"text/javascript"
src=
"%% JS_DIR %%/d3.v3.min.js"
></script>
<script
type=
'text/javascript'
src=
"%% JS_DIR %%/dagre-d3.js"
></script>
<script
type=
"text/javascript"
src=
"%% JS_DIR %%/dagre-d3.js"
></script>
<script
type=
'text/javascript'
src=
"%% JS_DIR %%/graphlib-dot.js"
></script>
<script
type=
"text/javascript"
src=
"%% JS_DIR %%/graphlib-dot.js"
></script>
<script
type=
'text/javascript'
src=
"%% JS_DIR %%/d3-context-menu.js"
></script>
<script
type=
"text/javascript"
src=
"%% JS_DIR %%/d3-context-menu.js"
></script>
</head>
</head>
<body>
<body>
<div
id=
'menu'
class=
'menuBar'
>
<div
id=
'menu'
class=
'menuBar'
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论