提交 ea4fae3e authored 作者: James Bergstra's avatar James Bergstra

added test to reveal possible type mismatch error in tensor.stack

上级 95558d1e
...@@ -875,6 +875,15 @@ class T_Join_and_Split(unittest.TestCase): ...@@ -875,6 +875,15 @@ class T_Join_and_Split(unittest.TestCase):
return return
self.fail() self.fail()
def test_stack_mixed_type_constants(self):
a = as_tensor(1)
b = as_tensor(2.0)
c = as_tensor(3.0)
s = stack(a, b, c)
want = numpy.array([1, 2, 3])
self.failUnless((eval_outputs([s]) == want).all())
def test_stack_scalar(self): def test_stack_scalar(self):
a = as_tensor(1) a = as_tensor(1)
b = as_tensor(2) b = as_tensor(2)
...@@ -1774,6 +1783,7 @@ def test_smallest_stack(): ...@@ -1774,6 +1783,7 @@ def test_smallest_stack():
assert type(rval) == numpy.ndarray assert type(rval) == numpy.ndarray
assert [-4, -2] == list(rval) assert [-4, -2] == list(rval)
def test_smallest(): def test_smallest():
x = dvector() x = dvector()
y = dvector() y = dvector()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论