提交 956347fd authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Cast dense value to floatX if variable is a matrix

上级 25ea9bc3
...@@ -166,12 +166,13 @@ class SparseInferShapeTester(unittest.TestCase): ...@@ -166,12 +166,13 @@ class SparseInferShapeTester(unittest.TestCase):
def test_add_sd(self): def test_add_sd(self):
x = SparseType('csr', dtype=config.floatX)() x = SparseType('csr', dtype=config.floatX)()
y = tensor.matrix() y = tensor.matrix()
self._compile_and_check([x, y], self._compile_and_check(
[x + y], [x, y],
[sp.csr_matrix(random_lil((10, 40), [x + y],
config.floatX, 3)), [sp.csr_matrix(random_lil((10, 40),
numpy.random.randn(10, 40)], config.floatX, 3)),
AddSD) numpy.random.randn(10, 40).astype(config.floatX)],
AddSD)
def test_mul_ss(self): def test_mul_ss(self):
x = SparseType('csr', dtype=config.floatX)() x = SparseType('csr', dtype=config.floatX)()
...@@ -186,12 +187,13 @@ class SparseInferShapeTester(unittest.TestCase): ...@@ -186,12 +187,13 @@ class SparseInferShapeTester(unittest.TestCase):
def test_mul_sd(self): def test_mul_sd(self):
x = SparseType('csr', dtype=config.floatX)() x = SparseType('csr', dtype=config.floatX)()
y = tensor.matrix() y = tensor.matrix()
self._compile_and_check([x, y], self._compile_and_check(
[x * y], [x, y],
[sp.csr_matrix(random_lil((10, 40), [x * y],
config.floatX, 3)), [sp.csr_matrix(random_lil((10, 40),
numpy.random.randn(10, 40)], config.floatX, 3)),
MulSD) numpy.random.randn(10, 40).astype(config.floatX)],
MulSD)
class T_AddMul(unittest.TestCase): class T_AddMul(unittest.TestCase):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论