提交 78075be5 authored 作者: Frederic Bastien's avatar Frederic Bastien

Update test following code review and fix DebugMode

上级 ec8b9c33
...@@ -3676,6 +3676,9 @@ class Canonizer(gof.LocalOptimizer): ...@@ -3676,6 +3676,9 @@ class Canonizer(gof.LocalOptimizer):
new = _fill_chain(new, node.inputs)[0] new = _fill_chain(new, node.inputs)[0]
if new.type == out.type: if new.type == out.type:
# This happen with test
# theano/tensor/tests/test_opt.py:T_local_switch_sink
new.tag.values_eq_approx = values_eq_approx_remove_inf_nan
return [new] return [new]
else: else:
_logger.warning(' '.join(('CANONIZE FAILED: new, out = ', _logger.warning(' '.join(('CANONIZE FAILED: new, out = ',
......
...@@ -3983,11 +3983,11 @@ class T_local_switch_sink(unittest.TestCase): ...@@ -3983,11 +3983,11 @@ class T_local_switch_sink(unittest.TestCase):
resm[idx])).sum() == self.resm[idx].size resm[idx])).sum() == self.resm[idx].size
idx += 1 idx += 1
# This case caused a missed optimization in the past. # This case caused a missed optimization in the past.
x = T.dscalar('x') x = T.dscalar('x')
y = T.switch(x < 7, x, T.sqrt(x - 7)) y = T.switch(x < 7, x, T.sqrt(x - 7))
f = theano.function([x], T.grad(y, x)) f = theano.function([x], T.grad(y, x), self.mode)
assert f(5) == 1, f(5) assert f(5) == 1, f(5)
@attr('slow') @attr('slow')
def test_local_div_switch_sink(self): def test_local_div_switch_sink(self):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论