Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
1f5d3630
提交
1f5d3630
authored
9月 15, 2010
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove the broken allow_remove_inf in DebugMode. Something else will replace this later.
上级
952fd60a
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
4 行增加
和
15 行删除
+4
-15
debugmode.py
theano/compile/debugmode.py
+4
-15
没有找到文件。
theano/compile/debugmode.py
浏览文件 @
1f5d3630
...
...
@@ -42,10 +42,6 @@ AddConfigVar('DebugMode.check_strides',
"On difference: (0) - ignore, (1) warn, or (2) raise error"
),
IntParam
(
1
,
lambda
i
:
i
in
(
0
,
1
,
2
)))
AddConfigVar
(
'DebugMode.allow_remove_inf'
,
"True -> do we allow an optimization to replace an inf with another value"
,
BoolParam
(
False
))
import
logging
_logger
=
logging
.
getLogger
(
"theano.compile.debugmode"
)
_logger
.
setLevel
(
logging
.
WARNING
)
...
...
@@ -602,7 +598,7 @@ def _lessbroken_deepcopy(a):
assert
rval
.
dtype
==
a
.
dtype
return
rval
def
_find_bad_optimizations0
(
order
,
reasons
,
r_vals
,
allow_remove_inf
=
False
):
def
_find_bad_optimizations0
(
order
,
reasons
,
r_vals
):
"""Use a simple algorithm to find broken optimizations.
This algorithm is simple to understand, but sometimes when there's a problem it identifies
...
...
@@ -621,7 +617,7 @@ def _find_bad_optimizations0(order, reasons, r_vals, allow_remove_inf=False):
r_val
=
r_vals
[
r
]
assert
r
.
type
==
new_r
.
type
if
not
r
.
type
.
values_eq_approx
(
r_val
,
new_r_val
,
allow_remove_inf
=
allow_remove_inf
):
if
not
r
.
type
.
values_eq_approx
(
r_val
,
new_r_val
):
raise
BadOptimization
(
old_r
=
r
,
new_r
=
new_r
,
old_r_val
=
r_val
,
...
...
@@ -1049,7 +1045,6 @@ class _Linker(gof.link.LocalLinker):
print
r
,
s
assert
s
[
0
]
is
None
allow_remove_inf
=
self
.
maker
.
mode
.
allow_remove_inf
#try:
# compute the value of all variables
for
i
,
(
thunk_py
,
thunk_c
,
node
)
in
enumerate
(
zip
(
thunks_py
,
thunks_c
,
order
)):
...
...
@@ -1153,7 +1148,7 @@ class _Linker(gof.link.LocalLinker):
#print >> sys.stderr, i, "DEBUGMODE clearing output", r
# compares the version from thunk_py (in r_vals)
# to the version produced by thunk_c (in storage_map)
if
not
r
.
type
.
values_eq_approx
(
r_vals
[
r
],
storage_map
[
r
][
0
]
,
allow_remove_inf
=
allow_remove_inf
):
if
not
r
.
type
.
values_eq_approx
(
r_vals
[
r
],
storage_map
[
r
][
0
]):
raise
BadCLinkerOutput
(
r
,
val_py
=
r_vals
[
r
],
val_c
=
storage_map
[
r
][
0
])
else
:
#print >> sys.stderr, i, "DEBUGMODE storing reference output %x" % id(storage_map[r][0])
...
...
@@ -1173,7 +1168,7 @@ class _Linker(gof.link.LocalLinker):
if
True
:
gc
.
collect
()
_find_bad_optimizations
(
order
,
env
.
equivalence_tracker
.
reasons
,
r_vals
,
allow_remove_inf
=
allow_remove_inf
)
_find_bad_optimizations
(
order
,
env
.
equivalence_tracker
.
reasons
,
r_vals
)
#####
# Postcondition: the input and output variables are in the storage map, nothing more
...
...
@@ -1534,12 +1529,6 @@ class DebugMode(Mode):
different strides? (This can catch bugs, but is generally overly strict.) 0 no check, 1 warn, 2 err.
"""
allow_remove_inf
=
config
.
DebugMode
.
allow_remove_inf
"""
Default False. Do we allow that an optimization remove inf value.
This is usefull to test stabilization optimization.
"""
# This function will be used to create a FunctionMaker in
# function_module.function
def
function_maker
(
self
,
i
,
o
,
m
,
*
args
,
**
kwargs
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论