提交 2a84c901 authored 作者: David Warde-Farley's avatar David Warde-Farley

Test for CSMGrad infer_shape.

上级 af6b947a
......@@ -112,7 +112,21 @@ class SparseInferShapeTester(unittest.TestCase):
raise SkipTest('infer_shape not implemented for getitem2d yet')
def test_csm_grad(self):
raise SkipTest('somebody who understands this should write it')
for sparsetype in ('csr', 'csc'):
x = tensor.vector()
y = tensor.ivector()
z = tensor.ivector()
s = tensor.ivector()
spm = sp.csr_matrix(random_lil((100, 100), config.floatX, 5))
out = tensor.grad(dense_from_sparse(
CSM(sparsetype)(x, y, z, s)
).sum(), x)
self._compile_and_check([x, y, z, s],
[out],
[spm.data, spm.indices, spm.indptr,
spm.shape],
CSMGrad
)
def test_transpose(self):
x = SparseType('csr', dtype=config.floatX)()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论