Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
9ccf8eda
提交
9ccf8eda
authored
10月 24, 2014
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make pydotprint support Variables and apply node
Fix gh-2108
上级
77523c8e
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
20 行增加
和
9 行删除
+20
-9
printing.py
theano/printing.py
+15
-4
test_printing.py
theano/tests/test_printing.py
+5
-5
没有找到文件。
theano/printing.py
浏览文件 @
9ccf8eda
...
...
@@ -528,7 +528,8 @@ def pydotprint(fct, outfile=None,
"""
Print to a file (png format) the graph of a compiled theano function's ops.
:param fct: the theano fct returned by theano.function.
:param fct: a compiled Theano function, a Variable, an Apply or
a list of Variable.
:param outfile: the output file where to put the graph.
:param compact: if True, will remove intermediate var that don't have name.
:param format: the file format of the output.
...
...
@@ -597,9 +598,19 @@ def pydotprint(fct, outfile=None,
outputs
=
fct
.
outputs
topo
=
fct
.
toposort
()
else
:
raise
ValueError
((
'pydotprint expects as input a theano.function or '
'the FunctionGraph of a function!'
),
fct
)
if
isinstance
(
fct
,
gof
.
Variable
):
fct
=
[
fct
]
elif
isinstance
(
fct
,
gof
.
Apply
):
fct
=
fct
.
outputs
assert
isinstance
(
fct
,
(
list
,
tuple
))
assert
all
(
isinstance
(
v
,
gof
.
Variable
)
for
v
in
fct
)
inputs
=
gof
.
graph
.
inputs
(
fct
)
fct
=
gof
.
FunctionGraph
(
inputs
=
gof
.
graph
.
inputs
(
fct
),
outputs
=
fct
)
mode
=
None
profile
=
None
outputs
=
fct
.
outputs
topo
=
fct
.
toposort
()
if
not
pydot_imported
:
raise
RuntimeError
(
"Failed to import pydot. You must install pydot"
" for `pydotprint` to work."
)
...
...
theano/tests/test_printing.py
浏览文件 @
9ccf8eda
...
...
@@ -68,6 +68,7 @@ def test_pydotprint_variables():
theano
.
theano_logger
.
removeHandler
(
orig_handler
)
theano
.
theano_logger
.
addHandler
(
new_handler
)
try
:
theano
.
printing
.
pydotprint
(
x
*
2
)
theano
.
printing
.
pydotprint_variables
(
x
*
2
)
finally
:
theano
.
theano_logger
.
addHandler
(
orig_handler
)
...
...
@@ -92,14 +93,13 @@ def test_pydotprint_long_name():
f
=
theano
.
function
([
x
],
[
x
*
2
,
x
+
x
],
mode
=
mode
)
f
([
1
,
2
,
3
,
4
])
s
=
StringIO
()
new_handler
=
logging
.
StreamHandler
(
s
)
new_handler
.
setLevel
(
logging
.
DEBUG
)
orig_handler
=
theano
.
logging_default_handler
theano
.
printing
.
pydotprint
(
f
,
max_label_size
=
5
,
print_output_file
=
False
,
assert_nb_all_strings
=
6
)
theano
.
printing
.
pydotprint
([
x
*
2
,
x
+
x
],
max_label_size
=
5
,
print_output_file
=
False
,
assert_nb_all_strings
=
8
)
def
test_pydotprint_profile
():
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论