提交 1f5d3630 authored 作者: Frederic Bastien's avatar Frederic Bastien

remove the broken allow_remove_inf in DebugMode. Something else will replace this later.

上级 952fd60a
......@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论