提交 91077b07 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Merge pull request #1675 from nouiz/fix_test_float32

c.data + 1 return numpy.float64 when c.data is float32. But we compute i...
...@@ -5960,15 +5960,15 @@ class T_get_scalar_constant_value(unittest.TestCase): ...@@ -5960,15 +5960,15 @@ class T_get_scalar_constant_value(unittest.TestCase):
# elemwise are in the fct. # elemwise are in the fct.
c = theano.tensor.constant(numpy.random.rand()) c = theano.tensor.constant(numpy.random.rand())
s = c + 1 s = c + 1
assert get_scalar_constant_value(s) == c.data + 1 assert numpy.allclose(get_scalar_constant_value(s), c.data + 1)
s = c - 1 s = c - 1
assert get_scalar_constant_value(s) == c.data - 1 assert numpy.allclose(get_scalar_constant_value(s), c.data - 1)
s = c * 1.2 s = c * 1.2
assert get_scalar_constant_value(s) == c.data * 1.2 assert numpy.allclose(get_scalar_constant_value(s), c.data * 1.2)
s = c < 0.5 s = c < 0.5
assert get_scalar_constant_value(s) == int(c.data < 0.5) assert numpy.allclose(get_scalar_constant_value(s), int(c.data < 0.5))
s = tensor.second(c, .4) s = tensor.second(c, .4)
assert get_scalar_constant_value(s) == .4 assert numpy.allclose(get_scalar_constant_value(s), .4)
def test_second(self): def test_second(self):
#Second should apply when the value is constant but not the shape #Second should apply when the value is constant but not the shape
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论