提交 fc75dbf9 authored 作者: lamblin's avatar lamblin

Merge pull request #642 from nouiz/scipy

Fix tests error when scipy is not there
...@@ -102,7 +102,7 @@ def test_neibs_manual(): ...@@ -102,7 +102,7 @@ def test_neibs_manual():
#print images.get_value(borrow=True) #print images.get_value(borrow=True)
neibs = f() neibs = f()
print neibs #print neibs
assert numpy.allclose(neibs,[[ 0, 1, 4, 5], assert numpy.allclose(neibs,[[ 0, 1, 4, 5],
[ 2, 3, 6, 7], [ 2, 3, 6, 7],
[ 8, 9, 12, 13], [ 8, 9, 12, 13],
...@@ -410,7 +410,7 @@ def tes_neibs2images_crash_on_grad(): ...@@ -410,7 +410,7 @@ def tes_neibs2images_crash_on_grad():
to_images = T.sum(neibs2images(neibs, (2, 2), (2, 3, 20, 20))) to_images = T.sum(neibs2images(neibs, (2, 2), (2, 3, 20, 20)))
g = T.grad(to_images, neibs) g = T.grad(to_images, neibs)
fn = theano.function([neibs], to_images, mode=mode_without_gpu) fn = theano.function([neibs], to_images, mode=mode_without_gpu)
print "Compiled" #print "Compiled"
fn(neibs_val) fn(neibs_val)
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -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 not S.enable_sparse:
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 not theano.sparse.enable_sparse:
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论