提交 9a9b3f91 authored 作者: James Bergstra's avatar James Bergstra

sparse tests: eliminated efficiency warning by updating lil format insteadof csc format

上级 cd458dd5
import scipy.sparse
from theano.sparse import * from theano.sparse import *
import random import random
...@@ -142,8 +143,10 @@ class T_conversion(unittest.TestCase): ...@@ -142,8 +143,10 @@ class T_conversion(unittest.TestCase):
self.failUnless(val.format == 'csr') self.failUnless(val.format == 'csr')
def test2(self): def test2(self):
#call dense_from_sparse
for t in _mtypes: for t in _mtypes:
s = t((2,5)) s = t((2,5))
s = t(scipy.sparse.identity(5))
d = dense_from_sparse(s) d = dense_from_sparse(s)
s[0,0] = 1.0 s[0,0] = 1.0
val = eval_outputs([d]) val = eval_outputs([d])
...@@ -161,11 +164,12 @@ class test_structureddot(unittest.TestCase): ...@@ -161,11 +164,12 @@ class test_structureddot(unittest.TestCase):
# iterate 10 times just to make sure (cannot get this wrong !) # iterate 10 times just to make sure (cannot get this wrong !)
for i in range(10): for i in range(10):
spmat = sp.csc_matrix((4,6)) spmat = sp.lil_matrix((4,6))
for i in range(5): for i in range(5):
x = numpy.floor(numpy.random.rand()*spmat.shape[0]) x = numpy.floor(numpy.random.rand()*spmat.shape[0])
y = numpy.floor(numpy.random.rand()*spmat.shape[1]) y = numpy.floor(numpy.random.rand()*spmat.shape[1])
spmat[x,y] = numpy.random.rand()*10 spmat[x,y] = numpy.random.rand()*10
spmat = sp.csc_matrix(spmat)
kerns = tensor.dvector('kerns') kerns = tensor.dvector('kerns')
images = tensor.dmatrix('images') images = tensor.dmatrix('images')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论