提交 a4b0a358 authored 作者: abalkin's avatar abalkin

Run basic take() test with and without the sum to allow testing preallocated output.

上级 6510f9e8
...@@ -7061,6 +7061,9 @@ class TestTensorInstanceMethods(unittest.TestCase): ...@@ -7061,6 +7061,9 @@ class TestTensorInstanceMethods(unittest.TestCase):
X, _ = self.vars X, _ = self.vars
x, _ = self.vals x, _ = self.vals
indices = [1,0,3] indices = [1,0,3]
assert_array_equal(X.take(indices).eval({X: x}), x.take(indices))
# The following line will exercise c_code with non-NULL output_name array
# when check_preallocated_output=ALL flag is set. (There should be a better way.)
assert_array_equal(X.take(indices).sum().eval({X: x}), x.take(indices).sum()) assert_array_equal(X.take(indices).sum().eval({X: x}), x.take(indices).sum())
indices = [1,0,1] indices = [1,0,1]
assert_array_equal(X.take(indices, 1).eval({X: x}), x.take(indices, 1)) assert_array_equal(X.take(indices, 1).eval({X: x}), x.take(indices, 1))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论