Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b74a272c
提交
b74a272c
authored
6月 22, 2011
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix a bug in pydotprint when cond_highlight is set and there is no Cond Op in the graph.
Test it too.
上级
d5cd4c00
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
31 行增加
和
1 行删除
+31
-1
printing.py
theano/printing.py
+13
-1
test_printing.py
theano/tests/test_printing.py
+18
-0
没有找到文件。
theano/printing.py
浏览文件 @
b74a272c
"""Pretty-printing (pprint()), the 'Print' Op, debugprint() and pydotprint().
"""Pretty-printing (pprint()), the 'Print' Op, debugprint() and pydotprint().
They all allow different way to print a graph or the result of an Op in a graph(Print Op)
They all allow different way to print a graph or the result of an Op in a graph(Print Op)
"""
"""
import
sys
,
os
,
StringIO
from
copy
import
copy
from
copy
import
copy
import
logging
import
sys
,
os
,
StringIO
import
numpy
import
numpy
...
@@ -14,6 +15,12 @@ from theano.gof.python25 import any
...
@@ -14,6 +15,12 @@ from theano.gof.python25 import any
from
theano.compile
import
Function
,
debugmode
from
theano.compile
import
Function
,
debugmode
from
theano.compile.profilemode
import
ProfileMode
from
theano.compile.profilemode
import
ProfileMode
_logger
=
logging
.
getLogger
(
"theano.tensor.basic"
)
def
_info
(
*
msg
):
_logger
.
info
(
' '
.
join
(
msg
))
def
_warn
(
*
msg
):
_logger
.
warn
(
' '
.
join
(
msg
))
def
debugprint
(
obj
,
depth
=-
1
,
print_type
=
False
,
file
=
None
):
def
debugprint
(
obj
,
depth
=-
1
,
print_type
=
False
,
file
=
None
):
"""Print a computation graph to file
"""Print a computation graph to file
...
@@ -464,10 +471,15 @@ def pydotprint(fct, outfile=None,
...
@@ -464,10 +471,15 @@ def pydotprint(fct, outfile=None,
c1
=
pd
.
Cluster
(
'Left'
)
c1
=
pd
.
Cluster
(
'Left'
)
c2
=
pd
.
Cluster
(
'Right'
)
c2
=
pd
.
Cluster
(
'Right'
)
c3
=
pd
.
Cluster
(
'Middle'
)
c3
=
pd
.
Cluster
(
'Middle'
)
cond
=
None
for
node
in
fct_env
.
toposort
():
for
node
in
fct_env
.
toposort
():
if
node
.
op
.
__class__
.
__name__
==
'Cond'
and
node
.
op
.
name
==
cond_highlight
:
if
node
.
op
.
__class__
.
__name__
==
'Cond'
and
node
.
op
.
name
==
cond_highlight
:
cond
=
node
cond
=
node
if
cond
is
None
:
_warn
(
"pydotprint: cond_highlight is set but there is no Cond node in the graph"
)
cond_highlight
=
None
if
cond_highlight
is
not
None
:
def
recursive_pass
(
x
,
ls
):
def
recursive_pass
(
x
,
ls
):
if
not
x
.
owner
:
if
not
x
.
owner
:
return
ls
return
ls
...
...
theano/tests/test_printing.py
0 → 100644
浏览文件 @
b74a272c
"""
This is a REALLY PARTIAL TEST.
I did them to help debug stuff.
"""
import
theano
import
theano.tensor
as
tensor
def
test_pydotprint_cond_highlight
():
x
=
tensor
.
dvector
()
f
=
theano
.
function
([
x
],
x
*
2
)
f
([
1
,
2
,
3
,
4
])
theano
.
printing
.
pydotprint
(
f
,
cond_highlight
=
True
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论