提交 e2a6481b authored 作者: Frederic's avatar Frederic

Fix test in FAST_COMPILE

上级 76c4e754
...@@ -1146,7 +1146,8 @@ class test_fusion(unittest.TestCase): ...@@ -1146,7 +1146,8 @@ class test_fusion(unittest.TestCase):
#we need the optimisation enabled and the canonicalize. #we need the optimisation enabled and the canonicalize.
#the canonicalize is needed to merge multiplication/addition by constant. #the canonicalize is needed to merge multiplication/addition by constant.
mode._optimizer = mode._optimizer.including( mode._optimizer = mode._optimizer.including(
'local_elemwise_fusion', 'canonicalize') 'local_elemwise_fusion', 'composite_elemwise_fusion',
'canonicalize')
self.do(mode, shared, shp) self.do(mode, shared, shp)
@attr('slow') @attr('slow')
...@@ -1156,7 +1157,8 @@ class test_fusion(unittest.TestCase): ...@@ -1156,7 +1157,8 @@ class test_fusion(unittest.TestCase):
#we need the optimisation enabled and the canonicalize. #we need the optimisation enabled and the canonicalize.
#the canonicalize is needed to merge multiplication/addition by constant. #the canonicalize is needed to merge multiplication/addition by constant.
mode._optimizer = mode._optimizer.including( mode._optimizer = mode._optimizer.including(
'local_elemwise_fusion', 'canonicalize') 'local_elemwise_fusion', 'composite_elemwise_fusion',
'canonicalize')
self.do(mode, shared, shp) self.do(mode, shared, shp)
def test_gpu_fusion(self): def test_gpu_fusion(self):
...@@ -1164,10 +1166,12 @@ class test_fusion(unittest.TestCase): ...@@ -1164,10 +1166,12 @@ class test_fusion(unittest.TestCase):
#we need the optimisation enabled, debug do this. #we need the optimisation enabled, debug do this.
if theano.config.mode == "FAST_COMPILE": if theano.config.mode == "FAST_COMPILE":
mode = theano.compile.mode.get_mode("FAST_RUN").including( mode = theano.compile.mode.get_mode("FAST_RUN").including(
'local_elemwise_fusion', 'canonicalize', 'gpu') 'local_elemwise_fusion', 'composite_elemwise_fusion',
'canonicalize', 'gpu')
else: else:
mode = theano.compile.mode.get_default_mode().including( mode = theano.compile.mode.get_default_mode().including(
'local_elemwise_fusion', 'canonicalize', 'gpu') 'local_elemwise_fusion', 'composite_elemwise_fusion',
'canonicalize', 'gpu')
import theano.sandbox.cuda as cuda import theano.sandbox.cuda as cuda
if not cuda.cuda_available: if not cuda.cuda_available:
raise SkipTest("cuda not available") raise SkipTest("cuda not available")
...@@ -1179,10 +1183,12 @@ class test_fusion(unittest.TestCase): ...@@ -1179,10 +1183,12 @@ class test_fusion(unittest.TestCase):
#we need the optimisation enabled, debug do this. #we need the optimisation enabled, debug do this.
if theano.config.mode == "FAST_COMPILE": if theano.config.mode == "FAST_COMPILE":
mode = theano.compile.mode.get_mode("FAST_RUN").including( mode = theano.compile.mode.get_mode("FAST_RUN").including(
'local_elemwise_fusion', 'canonicalize', 'gpu') 'local_elemwise_fusion', 'composite_elemwise_fusion',
'canonicalize', 'gpu')
else: else:
mode = theano.compile.mode.get_default_mode().including( mode = theano.compile.mode.get_default_mode().including(
'local_elemwise_fusion', 'canonicalize', 'gpu') 'local_elemwise_fusion', 'composite_elemwise_fusion',
'canonicalize', 'gpu')
import theano.sandbox.cuda as cuda import theano.sandbox.cuda as cuda
if not cuda.cuda_available: if not cuda.cuda_available:
raise SkipTest("cuda not available") raise SkipTest("cuda not available")
...@@ -1278,7 +1284,8 @@ class test_fusion(unittest.TestCase): ...@@ -1278,7 +1284,8 @@ class test_fusion(unittest.TestCase):
#we need the optimisation enabled and the canonicalize. #we need the optimisation enabled and the canonicalize.
#the canonicalize is needed to merge multiplication/addition by constant. #the canonicalize is needed to merge multiplication/addition by constant.
mode._optimizer = mode._optimizer.including( mode._optimizer = mode._optimizer.including(
'local_elemwise_fusion', 'canonicalize', 'inplace') 'local_elemwise_fusion', 'composite_elemwise_fusion',
'canonicalize', 'inplace')
x, y, z = dmatrices('xyz') x, y, z = dmatrices('xyz')
f = theano.function([x, y, z], tensor.dot(x, y) + x + y + z, mode=mode) f = theano.function([x, y, z], tensor.dot(x, y) + x + y + z, mode=mode)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论