提交 6d0827b7 authored 作者: Frederic Bastien's avatar Frederic Bastien

add assert to test.

上级 744c86af
...@@ -1737,17 +1737,20 @@ class T_local_erfc(unittest.TestCase): ...@@ -1737,17 +1737,20 @@ class T_local_erfc(unittest.TestCase):
f = theano.function([x],T.log(T.erfc(x)), mode=mode) f = theano.function([x],T.log(T.erfc(x)), mode=mode)
#theano.printing.debugprint(f) #theano.printing.debugprint(f)
assert len(f.maker.env.nodes)==22, len(f.maker.env.nodes) assert len(f.maker.env.nodes)==22, len(f.maker.env.nodes)
assert f.maker.env.outputs[0].dtype==theano.config.floatX
assert not any([hasattr(n.op,'scalar_op') and n.op.scalar_op==scal.pow for n in f.maker.env.nodes]) assert not any([hasattr(n.op,'scalar_op') and n.op.scalar_op==scal.pow for n in f.maker.env.nodes])
assert all(numpy.isfinite(f(val))) assert all(numpy.isfinite(f(val)))
f = theano.function([x],T.log(T.erfc(-x)), mode=mode) f = theano.function([x],T.log(T.erfc(-x)), mode=mode)
#theano.printing.debugprint(f) #theano.printing.debugprint(f)
assert len(f.maker.env.nodes)==23, len(f.maker.env.nodes) assert len(f.maker.env.nodes)==23, len(f.maker.env.nodes)
assert f.maker.env.outputs[0].dtype==theano.config.floatX
assert not any([hasattr(n.op,'scalar_op') and n.op.scalar_op==scal.pow for n in f.maker.env.nodes]) assert not any([hasattr(n.op,'scalar_op') and n.op.scalar_op==scal.pow for n in f.maker.env.nodes])
assert all(numpy.isfinite(f(-val))) assert all(numpy.isfinite(f(-val)))
f = theano.function([x],T.log(T.erfc(x)), mode=mode_fusion) f = theano.function([x],T.log(T.erfc(x)), mode=mode_fusion)
assert len(f.maker.env.nodes)==1, len(f.maker.env.nodes) assert len(f.maker.env.nodes)==1, len(f.maker.env.nodes)
assert f.maker.env.outputs[0].dtype==theano.config.floatX
assert len(f.maker.env.toposort()[0].env.toposort()[0].op.scalar_op.env.nodes)==4,len(f.maker.env.toposort()[0].env.toposort()[0].op.scalar_op.env.nodes) assert len(f.maker.env.toposort()[0].env.toposort()[0].op.scalar_op.env.nodes)==4,len(f.maker.env.toposort()[0].env.toposort()[0].op.scalar_op.env.nodes)
assert not any([hasattr(n.op,'scalar_op') and n.op.scalar_op==scal.pow for n in f.maker.env.nodes]) assert not any([hasattr(n.op,'scalar_op') and n.op.scalar_op==scal.pow for n in f.maker.env.nodes])
if theano.config.floatX=="float32" and theano.config.mode in ["DebugMode", "DEBUG_MODE"]: if theano.config.floatX=="float32" and theano.config.mode in ["DebugMode", "DEBUG_MODE"]:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论