Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
4a49cc9e
提交
4a49cc9e
authored
4月 07, 2015
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make DebugMode actually accept that certain nodes will have a different idea of eq_approx.
上级
f8e1fb6e
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
22 行增加
和
14 行删除
+22
-14
debugmode.py
theano/compile/debugmode.py
+22
-14
没有找到文件。
theano/compile/debugmode.py
浏览文件 @
4a49cc9e
...
@@ -721,6 +721,13 @@ class DataDestroyed():
...
@@ -721,6 +721,13 @@ class DataDestroyed():
data_destroyed
=
DataDestroyed
()
data_destroyed
=
DataDestroyed
()
def
check_eq
(
var
,
val1
,
val2
):
if
hasattr
(
var
.
tag
,
'values_eq_approx'
):
return
var
.
tag
.
values_eq_approx
(
val1
,
val2
)
else
:
return
var
.
type
.
values_eq_approx
(
val1
,
val2
)
def
_check_inputs
(
node
,
storage_map
,
r_vals
,
dr_vals
,
active_nodes
,
def
_check_inputs
(
node
,
storage_map
,
r_vals
,
dr_vals
,
active_nodes
,
clobber_dr_vals
=
True
,
clobber_dr_vals
=
True
,
perform
=
None
,
warn_input_not_reused
=
True
):
perform
=
None
,
warn_input_not_reused
=
True
):
...
@@ -945,7 +952,10 @@ def _find_bad_optimizations0(order, reasons, r_vals):
...
@@ -945,7 +952,10 @@ def _find_bad_optimizations0(order, reasons, r_vals):
r_val
=
r_vals
[
r
]
r_val
=
r_vals
[
r
]
assert
r
.
type
==
new_r
.
type
assert
r
.
type
==
new_r
.
type
if
hasattr
(
new_r
,
'values_eq_approx'
):
if
hasattr
(
new_r
.
tag
,
'values_eq_approx'
):
check
=
new_r
.
tag
.
values_eq_approx
(
r_val
,
new_r_val
)
elif
hasattr
(
new_r
,
'values_eq_approx'
):
# This way will be deprecated later, but not right now
check
=
new_r
.
values_eq_approx
(
r_val
,
new_r_val
)
check
=
new_r
.
values_eq_approx
(
r_val
,
new_r_val
)
else
:
else
:
check
=
r
.
type
.
values_eq_approx
(
r_val
,
new_r_val
)
check
=
r
.
type
.
values_eq_approx
(
r_val
,
new_r_val
)
...
@@ -1372,7 +1382,7 @@ def _check_preallocated_output(node, thunk, prealloc_modes, def_val,
...
@@ -1372,7 +1382,7 @@ def _check_preallocated_output(node, thunk, prealloc_modes, def_val,
_check_viewmap
(
node
,
storage_map
)
_check_viewmap
(
node
,
storage_map
)
for
r
in
node
.
outputs
:
for
r
in
node
.
outputs
:
if
not
r
.
type
.
values_eq_approx
(
r_vals
[
r
],
storage_map
[
r
][
0
]):
if
not
check_eq
(
r
,
r_vals
[
r
],
storage_map
[
r
][
0
]):
# TODO: indicate it is not a C/Py problem
# TODO: indicate it is not a C/Py problem
inputs_val
=
[
storage_map
[
inp
][
0
]
for
inp
in
r
.
owner
.
inputs
]
inputs_val
=
[
storage_map
[
inp
][
0
]
for
inp
in
r
.
owner
.
inputs
]
raise
BadThunkOutput
(
r
,
raise
BadThunkOutput
(
r
,
...
@@ -2023,22 +2033,20 @@ class _Linker(gof.link.LocalLinker):
...
@@ -2023,22 +2033,20 @@ class _Linker(gof.link.LocalLinker):
# Check with Python result
# Check with Python result
for
r
in
node
.
outputs
:
for
r
in
node
.
outputs
:
if
r
in
r_vals
:
if
r
in
r_vals
:
#print >> sys.stderr, i, "DEBUGMODE clearing output", r
# compares the version from thunk_py
# compares the version from thunk_py (in r_vals)
# (in r_vals) to the version produced
# to the version produced by thunk_c (in storage_map)
# by thunk_c (in storage_map)
if
not
r
.
type
.
values_eq_approx
(
r_vals
[
r
],
storage_map
[
r
][
0
]):
if
not
check_eq
(
r
,
r_vals
[
r
],
storage_map
[
r
][
0
]):
#import pdb; pdb.set_trace()
#r.type.values_eq_approx(r_vals[r], storage_map[r][0])
inputs_val
=
[
storage_map
[
inp
][
0
]
for
inp
in
r
.
owner
.
inputs
]
inputs_val
=
[
storage_map
[
inp
][
0
]
for
inp
in
r
.
owner
.
inputs
]
raise
BadThunkOutput
(
r
,
raise
BadThunkOutput
(
thunk1
=
'perform'
,
val1
=
r_vals
[
r
],
r
,
thunk1
=
'perform'
,
val1
=
r_vals
[
r
],
thunk2
=
'c_code'
,
val2
=
storage_map
[
r
][
0
],
thunk2
=
'c_code'
,
val2
=
storage_map
[
r
][
0
],
inputs_val
=
inputs_val
)
inputs_val
=
inputs_val
)
else
:
else
:
#print >> sys.stderr, i, "DEBUGMODE storing reference output %x" % id(storage_map[r][0])
# retrieve each output from the storage_map
# retrieve each output from the storage_map
r_vals
[
r
]
=
storage_map
[
r
][
0
]
r_vals
[
r
]
=
storage_map
[
r
][
0
]
storage_map
[
r
][
0
]
=
None
# clear the storage_map for the thunk_c
# clear the storage_map for the thunk_c
storage_map
[
r
][
0
]
=
None
if
self
.
maker
.
mode
.
check_preallocated_output
:
if
self
.
maker
.
mode
.
check_preallocated_output
:
prealloc_modes
=
\
prealloc_modes
=
\
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论