Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
83316061
提交
83316061
authored
2月 29, 2012
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debugprint now stop printing the "|" symbol in a columns after the last input.
上级
ec0e7537
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
23 行增加
和
12 行删除
+23
-12
NEWS.txt
NEWS.txt
+1
-0
debugmode.py
theano/compile/debugmode.py
+14
-4
test_printing.py
theano/tests/test_printing.py
+8
-8
没有找到文件。
NEWS.txt
浏览文件 @
83316061
...
@@ -24,6 +24,7 @@ New Feature
...
@@ -24,6 +24,7 @@ New Feature
as this is more readable.
as this is more readable.
* debugprint new param stop_on_name=[False,True]. If True, we don't print
* debugprint new param stop_on_name=[False,True]. If True, we don't print
anything bellow an intermediate variable that have a name. Default to False.
anything bellow an intermediate variable that have a name. Default to False.
* debugprint now stop printing the "|" symbol in a columns after the last input.
=============
=============
Release Notes
Release Notes
...
...
theano/compile/debugmode.py
浏览文件 @
83316061
...
@@ -502,7 +502,8 @@ def char_from_number(number):
...
@@ -502,7 +502,8 @@ def char_from_number(number):
def
debugprint
(
r
,
prefix
=
''
,
depth
=-
1
,
done
=
None
,
print_type
=
False
,
def
debugprint
(
r
,
prefix
=
''
,
depth
=-
1
,
done
=
None
,
print_type
=
False
,
file
=
sys
.
stdout
,
print_destroy_map
=
False
,
print_view_map
=
False
,
file
=
sys
.
stdout
,
print_destroy_map
=
False
,
print_view_map
=
False
,
order
=
[],
ids
=
'CHAR'
,
stop_on_name
=
False
):
order
=
[],
ids
=
'CHAR'
,
stop_on_name
=
False
,
prefix_child
=
None
):
"""Print the graph leading to `r` to given depth.
"""Print the graph leading to `r` to given depth.
:param r: Variable instance
:param r: Variable instance
...
@@ -535,6 +536,9 @@ def debugprint(r, prefix='', depth=-1, done=None, print_type=False,
...
@@ -535,6 +536,9 @@ def debugprint(r, prefix='', depth=-1, done=None, print_type=False,
else
:
else
:
type_str
=
''
type_str
=
''
if
prefix_child
is
None
:
prefix_child
=
prefix
def
get_id_str
(
obj
):
def
get_id_str
(
obj
):
if
obj
in
done
:
if
obj
in
done
:
id_str
=
"[@
%
s]"
%
done
[
obj
]
id_str
=
"[@
%
s]"
%
done
[
obj
]
...
@@ -598,10 +602,16 @@ def debugprint(r, prefix='', depth=-1, done=None, print_type=False,
...
@@ -598,10 +602,16 @@ def debugprint(r, prefix='', depth=-1, done=None, print_type=False,
if
not
already_printed
:
if
not
already_printed
:
if
(
not
stop_on_name
or
if
(
not
stop_on_name
or
not
(
hasattr
(
r
,
'name'
)
and
r
.
name
is
not
None
)):
not
(
hasattr
(
r
,
'name'
)
and
r
.
name
is
not
None
)):
for
i
in
a
.
inputs
:
new_prefix
=
prefix_child
+
' |'
debugprint
(
i
,
prefix
+
' |'
,
depth
=
depth
-
1
,
done
=
done
,
new_prefix_child
=
prefix_child
+
' |'
for
idx
,
i
in
enumerate
(
a
.
inputs
):
if
idx
==
len
(
a
.
inputs
)
-
1
:
new_prefix_child
=
prefix_child
+
' '
debugprint
(
i
,
new_prefix
,
depth
=
depth
-
1
,
done
=
done
,
print_type
=
print_type
,
file
=
file
,
order
=
order
,
print_type
=
print_type
,
file
=
file
,
order
=
order
,
ids
=
ids
,
stop_on_name
=
stop_on_name
)
ids
=
ids
,
stop_on_name
=
stop_on_name
,
prefix_child
=
new_prefix_child
)
else
:
else
:
#this is an input variable
#this is an input variable
id_str
=
get_id_str
(
r
)
id_str
=
get_id_str
(
r
)
...
...
theano/tests/test_printing.py
浏览文件 @
83316061
...
@@ -112,8 +112,8 @@ def test_debugprint():
...
@@ -112,8 +112,8 @@ def test_debugprint():
| |A [@2]
| |A [@2]
| |B [@3]
| |B [@3]
|Elemwise{add,no_inplace} [@4] ''
|Elemwise{add,no_inplace} [@4] ''
|
|D [@5]
|D [@5]
|
|E [@6]
|E [@6]
"""
"""
if
s
!=
reference
:
if
s
!=
reference
:
...
@@ -132,8 +132,8 @@ def test_debugprint():
...
@@ -132,8 +132,8 @@ def test_debugprint():
| |A [@C]
| |A [@C]
| |B [@D]
| |B [@D]
|Elemwise{add,no_inplace} [@E] ''
|Elemwise{add,no_inplace} [@E] ''
|
|D [@F]
|D [@F]
|
|E [@G]
|E [@G]
"""
"""
if
s
!=
reference
:
if
s
!=
reference
:
...
@@ -151,8 +151,8 @@ def test_debugprint():
...
@@ -151,8 +151,8 @@ def test_debugprint():
reference
=
"""Elemwise{add,no_inplace} [@A] ''
reference
=
"""Elemwise{add,no_inplace} [@A] ''
|Elemwise{add,no_inplace} [@B] 'C'
|Elemwise{add,no_inplace} [@B] 'C'
|Elemwise{add,no_inplace} [@C] ''
|Elemwise{add,no_inplace} [@C] ''
|
|D [@D]
|D [@D]
|
|E [@E]
|E [@E]
"""
"""
if
s
!=
reference
:
if
s
!=
reference
:
...
@@ -172,8 +172,8 @@ def test_debugprint():
...
@@ -172,8 +172,8 @@ def test_debugprint():
| |A
| |A
| |B
| |B
|Elemwise{add,no_inplace} ''
|Elemwise{add,no_inplace} ''
|
|D
|D
|
|E
|E
"""
"""
if
s
!=
reference
:
if
s
!=
reference
:
print
'--'
+
s
+
'--'
print
'--'
+
s
+
'--'
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论