Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
eb535917
提交
eb535917
authored
2月 08, 2010
作者:
James Bergstra
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
DebugMode - modified linker to override TensorType.filter_checks_isfinite only
for the duration of a single function evaluation, rather than globally at the creation of a DebugMode function
上级
29efb1ad
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
28 行增加
和
11 行删除
+28
-11
debugmode.py
theano/compile/debugmode.py
+28
-11
没有找到文件。
theano/compile/debugmode.py
浏览文件 @
eb535917
...
...
@@ -868,6 +868,11 @@ class _Linker(gof.link.LocalLinker):
return
self
def
make_all
(
self
,
profiler
=
None
,
input_storage
=
None
,
output_storage
=
None
):
if
1
:
#can't import at toplevel because of circular import
# TODO: don't do this ugly hacky way of setting the filter_checks_isfinite
from
theano.tensor
import
TensorType
#to set filter_check_isfinite
env
=
self
.
env
input_storage_
=
input_storage
output_storage_
=
output_storage
...
...
@@ -932,7 +937,7 @@ class _Linker(gof.link.LocalLinker):
# This is the function that runs when you evaluate the graph
#####
def
f
():
debug
(
"starting
f
"
)
debug
(
"starting
a DebugMode call
"
)
for
x
in
no_recycling
:
x
[
0
]
=
None
...
...
@@ -1027,7 +1032,10 @@ class _Linker(gof.link.LocalLinker):
storage_map
[
r
][
0
]
=
_lessbroken_deepcopy
(
r_vals
[
r
])
debug
(
i
,
"DEBUGMODE running thunk_c"
)
thunk_c
()
try
:
thunk_c
()
except
:
raise_with_op
(
node
)
for
r
in
node
.
outputs
:
# check output values for type-correctness
...
...
@@ -1075,9 +1083,6 @@ class _Linker(gof.link.LocalLinker):
if
True
:
gc
.
collect
()
#except:
# raise_with_op(node)
_find_bad_optimizations
(
order
,
env
.
equivalence_tracker
.
reasons
,
r_vals
)
#####
...
...
@@ -1132,10 +1137,27 @@ class _Linker(gof.link.LocalLinker):
if
(
r
.
owner
is
None
):
assert
storage_map
[
r
][
0
]
is
not
None
###############
# Done
f
# Done
debugmode function call 'f'
##############
def
run_with_tensortype_filter_check
(
f
):
def
deco
():
# WARNING: this is a global mechanism...
# so it will screw up if we are trying to use
# multiple modes at once.
old_filter_checks_isfinite
=
TensorType
.
filter_checks_isfinite
TensorType
.
filter_checks_isfinite
=
self
.
maker
.
mode
.
check_isfinite
try
:
return
f
()
finally
:
# put back the filter_checks_isfinite
TensorType
.
filter_checks_isfinite
=
old_filter_checks_isfinite
return
deco
f
=
run_with_tensortype_filter_check
(
f
)
f
.
allow_gc
=
True
assert
len
(
env
.
inputs
)
==
len
(
input_storage
)
assert
len
(
env
.
outputs
)
==
len
(
output_storage
)
...
...
@@ -1170,11 +1192,6 @@ class _Maker(FunctionMaker): #inheritance buys a few helper functions
"""
# WARNING: this is a global mechanism... so it will screw up if we are trying to use
# multiple modes at once.
from
theano.tensor
import
TensorType
#to set filter_check_isfinite
TensorType
.
filter_checks_isfinite
=
mode
.
check_isfinite
# Handle the case where inputs and/or outputs is a single Variable (not in a list)
unpack_single
=
False
return_none
=
False
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论