提交 19f1566f authored 作者: Ricardo's avatar Ricardo 提交者: Thomas Wiecki

Remove `warn__identify_1pexp_bug` flag

上级 a5b7b68f
...@@ -1436,14 +1436,6 @@ def add_deprecated_configvars(): ...@@ -1436,14 +1436,6 @@ def add_deprecated_configvars():
in_c_key=False, in_c_key=False,
) )
# TODO: remove?
config.add(
"warn__identify_1pexp_bug",
"Warn if Aesara versions prior to 7987b51 (2011-12-18) could have "
"yielded a wrong result due to a bug in the is_1pexp function",
BoolParam(_warn_default("0.4.1")),
in_c_key=False,
)
# TODO: this setting is not used anywhere # TODO: this setting is not used anywhere
config.add( config.add(
"gpu__local_elemwise_fusion", "gpu__local_elemwise_fusion",
......
...@@ -3068,19 +3068,6 @@ def is_1pexp(t, only_process_constants=True): ...@@ -3068,19 +3068,6 @@ def is_1pexp(t, only_process_constants=True):
scal_sum = scal_sum + s scal_sum = scal_sum + s
if np.allclose(scal_sum, 1): if np.allclose(scal_sum, 1):
return False, maybe_exp.owner.inputs[0] return False, maybe_exp.owner.inputs[0]
# Before 7987b51 there used to be a bug where *any* constant
# was considered as if it was equal to 1, and thus this
# function would incorrectly identify it as (1 + exp(x)).
if config.warn__identify_1pexp_bug:
warnings.warn(
"Although your current code is fine, please note that "
"Aesara versions prior to 0.5 (more specifically, "
"prior to commit 7987b51 on 2011-12-18) may have "
"yielded an incorrect result. To remove this warning, "
"either set the `warn__identify_1pexp_bug` config "
"option to False, or `warn__ignore_bug_before` to at "
"least '0.4.1'."
)
return None return None
......
...@@ -4074,9 +4074,6 @@ class TestSigmoidOpts: ...@@ -4074,9 +4074,6 @@ class TestSigmoidOpts:
x = vector() x = vector()
data = np.random.random((54)).astype(config.floatX) data = np.random.random((54)).astype(config.floatX)
backup = config.warn__identify_1pexp_bug
config.warn__identify_1pexp_bug = False
try:
# tests exp_over_1_plus_exp # tests exp_over_1_plus_exp
f = aesara.function([x], exp(x) / (1 + exp(x)), mode=m) f = aesara.function([x], exp(x) / (1 + exp(x)), mode=m)
assert [node.op for node in f.maker.fgraph.toposort()] == [sigmoid] assert [node.op for node in f.maker.fgraph.toposort()] == [sigmoid]
...@@ -4205,10 +4202,6 @@ class TestSigmoidOpts: ...@@ -4205,10 +4202,6 @@ class TestSigmoidOpts:
] ]
f(data) f(data)
finally:
# Restore config option.
config.warn__identify_1pexp_bug = backup
def test_local_1msigmoid(self): def test_local_1msigmoid(self):
m = self.get_mode(excluding=["fusion", "inplace"]) m = self.get_mode(excluding=["fusion", "inplace"])
x = fmatrix() x = fmatrix()
...@@ -4465,9 +4458,6 @@ class TestSigmoidUtils: ...@@ -4465,9 +4458,6 @@ class TestSigmoidUtils:
] ]
def test_is_1pexp(self): def test_is_1pexp(self):
backup = config.warn__identify_1pexp_bug
config.warn__identify_1pexp_bug = False
try:
x = vector("x") x = vector("x")
exp_op = exp exp_op = exp
assert is_1pexp(1 + exp_op(x), False) == (False, x) assert is_1pexp(1 + exp_op(x), False) == (False, x)
...@@ -4483,8 +4473,6 @@ class TestSigmoidUtils: ...@@ -4483,8 +4473,6 @@ class TestSigmoidUtils:
assert is_1pexp(exp_op(x) - 1, False) is None assert is_1pexp(exp_op(x) - 1, False) is None
assert is_1pexp(-1 + exp_op(x), False) is None assert is_1pexp(-1 + exp_op(x), False) is None
assert is_1pexp(1 + 2 * exp_op(x), False) is None assert is_1pexp(1 + 2 * exp_op(x), False) is None
finally:
config.warn__identify_1pexp_bug = backup
def test_log1mexp_stabilization(): def test_log1mexp_stabilization():
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论