提交 1e2cf8e3 authored 作者: Frederic Bastien's avatar Frederic Bastien

some fix to sparse when scipy is not available.

make the import of theano.sparse work with an empty module if scipy is not available. Make sparse test skipped if scipy not available.
上级 306e840e
import sys,scipy import sys
enable_sparse=True enable_sparse=True
if not scipy.__version__.startswith('0.7.'):
sys.stderr.write("WARNING: scipy version = %s. We request version >=0.7.0 for the sparse code as it has bugs fixed in the sparse matrix code.\n" % scipy.__version__)
enable_sparse=False
try:
import scipy
if not scipy.__version__.startswith('0.7.'):
sys.stderr.write("WARNING: scipy version = %s. We request version >=0.7.0 for the sparse code as it has bugs fixed in the sparse matrix code.\n" % scipy.__version__)
enable_sparse=False
except ImportError:
enable_sparse=False
sys.stderr.write("WARNING: scipy can't be imported. We disable the sparse matrix code.")
if enable_sparse: if enable_sparse:
from basic import * from basic import *
import scipy.sparse
from theano.sparse import * from theano.sparse import *
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
if enable_sparse == False: if enable_sparse == False:
raise SkipTest('Optional package sparse disabled') raise SkipTest('Optional package sparse disabled')
import scipy.sparse
import random, time import random, time
import unittest import unittest
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论