提交 b8c39daf authored 作者: Frederic Bastien's avatar Frederic Bastien

Skip test correctly when scipy is not there.

上级 f8842359
...@@ -7,14 +7,14 @@ except ImportError: ...@@ -7,14 +7,14 @@ except ImportError:
import theano import theano
from theano import config, tensor from theano import config, tensor
from theano.sparse import (enable_sparse, CSM, CSMProperties, csm_properties, from theano.sparse import enable_sparse
CSC, CSR)
from theano.sparse.tests.test_basic import random_lil
from theano.gof.python25 import any from theano.gof.python25 import any
if not enable_sparse: if not enable_sparse:
raise SkipTest('Optional package sparse disabled') raise SkipTest('Optional package sparse disabled')
from theano.sparse import CSM, CSMProperties, csm_properties, CSC, CSR
from theano.sparse.tests.test_basic import random_lil
def test_local_csm_properties_csm(): def test_local_csm_properties_csm():
data = tensor.vector() data = tensor.vector()
......
...@@ -13,13 +13,13 @@ import theano ...@@ -13,13 +13,13 @@ import theano
from theano import tensor as T from theano import tensor as T
from theano import sparse as S from theano import sparse as S
if S.enable_sparse == False:
raise SkipTest('Optional package sparse disabled')
from theano.sparse.sandbox import sp2 as S2 from theano.sparse.sandbox import sp2 as S2
from theano.tests import unittest_tools as utt from theano.tests import unittest_tools as utt
if S.enable_sparse == False:
raise SkipTest('Optional package sparse disabled')
def as_sparse_format(data, format): def as_sparse_format(data, format):
if format == 'csc': if format == 'csc':
return scipy.sparse.csc_matrix(data) return scipy.sparse.csc_matrix(data)
......
import numpy import numpy
import theano.sparse
if theano.sparse.enable_sparse == False:
raise SkipTest('Optional package sparse disabled')
from theano.sparse.utils import hash_from_sparse from theano.sparse.utils import hash_from_sparse
from theano.sparse.tests.test_basic import as_sparse_format from theano.sparse.tests.test_basic import as_sparse_format
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论