提交 5a8f6d5d authored 作者: Frederic Bastien's avatar Frederic Bastien

Skip part of a test when scipy isn't there.

上级 2fe88f36
...@@ -32,6 +32,15 @@ from theano.scalar.basic_scipy import erfinv ...@@ -32,6 +32,15 @@ from theano.scalar.basic_scipy import erfinv
from theano.tensor.nnet.blocksparse import sparse_block_dot from theano.tensor.nnet.blocksparse import sparse_block_dot
from theano.sandbox.cuda.blocksparse import GpuSparseBlockGemv, GpuSparseBlockOuter from theano.sandbox.cuda.blocksparse import GpuSparseBlockGemv, GpuSparseBlockOuter
imported_scipy_special = False
try:
import scipy.special
imported_scipy_special = True
# Importing scipy.special may raise ValueError.
# See http://projects.scipy.org/scipy/ticket/1739
except (ImportError, ValueError):
pass
if theano.config.mode == 'FAST_COMPILE': if theano.config.mode == 'FAST_COMPILE':
mode_with_gpu = theano.compile.mode.get_mode('FAST_RUN').including('gpu') mode_with_gpu = theano.compile.mode.get_mode('FAST_RUN').including('gpu')
...@@ -753,6 +762,7 @@ def test_erfinvgpu(): ...@@ -753,6 +762,7 @@ def test_erfinvgpu():
assert isinstance(f.maker.fgraph.toposort()[1].op.scalar_op, assert isinstance(f.maker.fgraph.toposort()[1].op.scalar_op,
cuda.elemwise.ErfinvGPU) cuda.elemwise.ErfinvGPU)
xv = numpy.random.rand(7, 8).astype('float32') xv = numpy.random.rand(7, 8).astype('float32')
if imported_scipy_special:
assert numpy.allclose(f(xv), f2(xv)) assert numpy.allclose(f(xv), f2(xv))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论