提交 03435c8c authored 作者: Frederic's avatar Frederic

Make a test pass when the flag vm.lazy=False

上级 351d455b
...@@ -2,6 +2,7 @@ from copy import deepcopy ...@@ -2,6 +2,7 @@ from copy import deepcopy
import numpy import numpy
import theano
from theano.gof.op import PureOp from theano.gof.op import PureOp
from theano.gof import Apply, generic, Container from theano.gof import Apply, generic, Container
from theano.gof.link import LocalLinker, map_storage, add_clear_storage from theano.gof.link import LocalLinker, map_storage, add_clear_storage
...@@ -99,22 +100,28 @@ def test_ifelse(): ...@@ -99,22 +100,28 @@ def test_ifelse():
c = generic() c = generic()
notimpl = NotImplementedOp() notimpl = NotImplementedOp()
lazys = [True]
f = function([a,b,c], ifelse(a, notimpl(b), c), # We need lazy to end up being True for this test.
mode=Mode(linker='vm', optimizer='fast_run')) if theano.config.vm.lazy in [True, None]:
lazys = [True, None]
try: for cloop in [True, False]:
print "case 1" for lazy in lazys:
f( 1, 'a', 'b') linker = theano.gof.vm.VM_Linker(use_cloop=cloop, lazy=lazy)
assert False f = function([a, b, c], ifelse(a, notimpl(b), c),
except NotImplementedOp.E: mode=Mode(linker=linker, optimizer='fast_run'))
pass
print "... passed" try:
print "case 1"
print "case 2" f(1, 'a', 'b')
print f( 0, 'a', 'b') assert False
assert f( 0, 'a', 'b') == 'b' except NotImplementedOp.E:
print "... passed" pass
print "... passed"
print "case 2"
print f(0, 'a', 'b')
assert f(0, 'a', 'b') == 'b'
print "... passed"
def more_complex_test(): def more_complex_test():
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论