提交 9fc8bf1c authored 作者: David Warde-Farley's avatar David Warde-Farley

Use non-square matrices in tests.

上级 1748c74e
...@@ -117,7 +117,7 @@ class SparseInferShapeTester(unittest.TestCase): ...@@ -117,7 +117,7 @@ class SparseInferShapeTester(unittest.TestCase):
y = tensor.ivector() y = tensor.ivector()
z = tensor.ivector() z = tensor.ivector()
s = tensor.ivector() s = tensor.ivector()
spm = sp.csr_matrix(random_lil((100, 100), config.floatX, 5)) spm = sp.csr_matrix(random_lil((200, 400), config.floatX, 5))
out = tensor.grad(dense_from_sparse( out = tensor.grad(dense_from_sparse(
CSM(sparsetype)(x, y, z, s) CSM(sparsetype)(x, y, z, s)
).sum(), x) ).sum(), x)
...@@ -132,7 +132,7 @@ class SparseInferShapeTester(unittest.TestCase): ...@@ -132,7 +132,7 @@ class SparseInferShapeTester(unittest.TestCase):
x = SparseType('csr', dtype=config.floatX)() x = SparseType('csr', dtype=config.floatX)()
self._compile_and_check([x], self._compile_and_check([x],
[x.T], [x.T],
[sp.csr_matrix(random_lil((10, 10), [sp.csr_matrix(random_lil((10, 40),
config.floatX, 3))], config.floatX, 3))],
Transpose) Transpose)
...@@ -140,7 +140,7 @@ class SparseInferShapeTester(unittest.TestCase): ...@@ -140,7 +140,7 @@ class SparseInferShapeTester(unittest.TestCase):
x = SparseType('csr', dtype=config.floatX)() x = SparseType('csr', dtype=config.floatX)()
self._compile_and_check([x], self._compile_and_check([x],
[-x], [-x],
[sp.csr_matrix(random_lil((10, 10), [sp.csr_matrix(random_lil((10, 40),
config.floatX, 3))], config.floatX, 3))],
Neg) Neg)
...@@ -149,9 +149,9 @@ class SparseInferShapeTester(unittest.TestCase): ...@@ -149,9 +149,9 @@ class SparseInferShapeTester(unittest.TestCase):
y = SparseType('csr', dtype=config.floatX)() y = SparseType('csr', dtype=config.floatX)()
self._compile_and_check([x, y], self._compile_and_check([x, y],
[x + y], [x + y],
[sp.csr_matrix(random_lil((10, 10), [sp.csr_matrix(random_lil((10, 40),
config.floatX, 3)), config.floatX, 3)),
sp.csr_matrix(random_lil((10, 10), sp.csr_matrix(random_lil((10, 40),
config.floatX, 3))], config.floatX, 3))],
AddSS) AddSS)
...@@ -160,7 +160,7 @@ class SparseInferShapeTester(unittest.TestCase): ...@@ -160,7 +160,7 @@ class SparseInferShapeTester(unittest.TestCase):
y = tensor.matrix() y = tensor.matrix()
self._compile_and_check([x, y], self._compile_and_check([x, y],
[x + y], [x + y],
[sp.csr_matrix(random_lil((10, 10), [sp.csr_matrix(random_lil((10, 40),
config.floatX, 3)), config.floatX, 3)),
numpy.random.randn(10, 10)], numpy.random.randn(10, 10)],
AddSD) AddSD)
...@@ -170,7 +170,7 @@ class SparseInferShapeTester(unittest.TestCase): ...@@ -170,7 +170,7 @@ class SparseInferShapeTester(unittest.TestCase):
y = SparseType('csr', dtype=config.floatX)() y = SparseType('csr', dtype=config.floatX)()
self._compile_and_check([x, y], self._compile_and_check([x, y],
[x * y], [x * y],
[sp.csr_matrix(random_lil((10, 10), [sp.csr_matrix(random_lil((10, 40),
config.floatX, 3)), config.floatX, 3)),
] * 2, ] * 2,
MulSS) MulSS)
...@@ -180,7 +180,7 @@ class SparseInferShapeTester(unittest.TestCase): ...@@ -180,7 +180,7 @@ class SparseInferShapeTester(unittest.TestCase):
y = tensor.matrix() y = tensor.matrix()
self._compile_and_check([x, y], self._compile_and_check([x, y],
[x * y], [x * y],
[sp.csr_matrix(random_lil((10, 10), [sp.csr_matrix(random_lil((10, 40),
config.floatX, 3)), config.floatX, 3)),
numpy.random.randn(10, 10)], numpy.random.randn(10, 10)],
MulSD) MulSD)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论