提交 fd79bcea authored 作者: Frederic's avatar Frederic

Add reshape test with size of 0, reused by new gpu back-end

上级 63a18e70
......@@ -4898,13 +4898,9 @@ class T_reshape(utt.InferShapeTester, utt.TestOptimizationMixin):
topo_ = [node for node in topo if not isinstance(node.op,
self.ignore_topo)]
assert len(topo_) == 1, topo_
assert type(topo_[0].op) is self.op
return f
def eval_output_and_check(self, t):
f = self.function([], t)
tval = f()
return tval
def test_reshape(self):
a = dvector()
b = dmatrix()
......@@ -5020,6 +5016,11 @@ class T_reshape(utt.InferShapeTester, utt.TestOptimizationMixin):
self.assertRaises(ValueError, f, a_val, [7, 5])
self.assertRaises(ValueError, f, a_val, [-1, -1])
def test_0(self):
x = fvector('x')
f = self.function([x], x.reshape((0, 100)))
assert f(numpy.ndarray((0,), dtype='float32')).shape == (0, 100)
def test_make_column_matrix_broadcastable():
# The goal of the operation made by `b` is to ensure the second dimension
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论