提交 7284da4e authored 作者: bergstra@ip05.m's avatar bergstra@ip05.m

removed sparse CSC1-related optimization. it doesnt speed things up

上级 1c2e05db
......@@ -165,7 +165,7 @@ class test_structureddot(unittest.TestCase):
for dense_dtype in typenames:
for sparse_dtype in typenames:
print >> sys.stderr, dense_dtype, sparse_dtype
#print >> sys.stderr, dense_dtype, sparse_dtype
# iterate for a few different random graph patterns
for i in range(10):
spmat = sp.csc_matrix((4,6), dtype=sparse_dtype)
......@@ -280,32 +280,5 @@ class test_structureddot(unittest.TestCase):
outvals = f(kernvals,imvals)
print outvals
def test_opt_ones(self):
spmat = sp.csc_matrix((4,6), dtype='int64')
for i in range(5):
# set 1s in random locations (row x, col y)
x = numpy.floor(numpy.random.rand()*spmat.shape[0])
y = numpy.floor(numpy.random.rand()*spmat.shape[1])
spmat[x,y] = 1
spmat = sp.csc_matrix(spmat)
images = tensor.Tensor(dtype='float32', broadcastable=[False, False])('images')
f = theano.function([images], structured_dot(spmat, images.T))
sdones_present = False
for i, node in enumerate(f.maker.env.toposort()):
print ' ', i, node.op
if isinstance(node.op, StructuredDotCSC1):
sdones_present = True
assert sdones_present
#print 'kdtype', kernvals.dtype, kernvals.shape, kernvals.ndim, kernvals.dtype.num
#print 'type of kernvals = ', kernvals.dtype
bsize = 3
imvals = 1.0 * numpy.array(numpy.arange(bsize*spmat.shape[1]).\
reshape(bsize,spmat.shape[1]), dtype='float32')
outvals = f(imvals)
print outvals
if __name__ == '__main__':
unittest.main()
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论