提交 385c6e19 authored 作者: Frederic's avatar Frederic

Some crash fix and skip some tests when g++ isn't available.

上级 a7b9a7e8
...@@ -371,7 +371,12 @@ class T_function(unittest.TestCase): ...@@ -371,7 +371,12 @@ class T_function(unittest.TestCase):
four = f(o) four = f(o)
assert numpy.all(four==4) assert numpy.all(four==4)
f(o+.1) #should clobber the memory used to store four f(o+.1) #should clobber the memory used to store four
assert not numpy.all(four==4) if theano.config.cxx:
assert not numpy.all(four==4)
else:
# The Elemwise.perform method don't reuse memory
# as some numpy version don't support that correctly.
assert numpy.all(four==4)
def test_disconnected_input(self): def test_disconnected_input(self):
a = T.scalar('a') a = T.scalar('a')
......
...@@ -160,7 +160,7 @@ else: ...@@ -160,7 +160,7 @@ else:
AddConfigVar('linker', AddConfigVar('linker',
("Default linker used if the theano flags mode is Mode " ("Default linker used if the theano flags mode is Mode "
"or ProfileMode(deprecated)"), "or ProfileMode(deprecated)"),
EnumStr('py', 'vm', 'vm_nogc'), EnumStr('vm', 'py', 'vm_nogc'),
in_c_key=False) in_c_key=False)
_logger.warning('g++ not detected ! Theano will be unable to execute ' _logger.warning('g++ not detected ! Theano will be unable to execute '
'optimized C-implementations (for both CPU and GPU) and will ' 'optimized C-implementations (for both CPU and GPU) and will '
......
import unittest import unittest
from nose.plugins.skip import SkipTest
import numpy import numpy
import theano import theano
import theano.gof.op as op import theano.gof.op as op
from theano.gof.type import Type, Generic from theano.gof.type import Type, Generic
from theano.gof.graph import Apply, Variable from theano.gof.graph import Apply, Variable
...@@ -130,6 +130,8 @@ class TestOp: ...@@ -130,6 +130,8 @@ class TestOp:
assert rval == 'test Op no input' assert rval == 'test Op no input'
def test_op_struct(self): def test_op_struct(self):
if not theano.config.cxx:
raise SkipTest("G++ not available, so we need to skip this test.")
sop = StructOp() sop = StructOp()
c = sop(theano.tensor.constant(0)) c = sop(theano.tensor.constant(0))
mode = None mode = None
......
import numpy import numpy
import theano
import theano
from theano import Op, Apply from theano import Op, Apply
from theano.tensor import TensorType from theano.tensor import TensorType
from theano.gof.type import CDataType from theano.gof.type import CDataType
from nose.plugins.skip import SkipTest
# todo: test generic # todo: test generic
class ProdOp(Op): class ProdOp(Op):
__props__ = () __props__ = ()
...@@ -57,6 +59,8 @@ Py_INCREF(%(out)s); ...@@ -57,6 +59,8 @@ Py_INCREF(%(out)s);
def test_cdata(): def test_cdata():
if not theano.config.cxx:
raise SkipTest("G++ not available, so we need to skip this test.")
i = TensorType('float32', (False,))() i = TensorType('float32', (False,))()
c = ProdOp()(i) c = ProdOp()(i)
i2 = GetOp()(c) i2 = GetOp()(c)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论