提交 74060c7c authored 作者: Sigurd Spieckermann's avatar Sigurd Spieckermann

added missing test for advanced indexing in local_subtensor_make_vector

上级 88223238
...@@ -1747,6 +1747,18 @@ class test_local_subtensor_make_vector(unittest.TestCase): ...@@ -1747,6 +1747,18 @@ class test_local_subtensor_make_vector(unittest.TestCase):
r = f(0, 1, 2) r = f(0, 1, 2)
assert r[0] == 0 and r[1] == 2 assert r[0] == 0 and r[1] == 2
def test_AdvancedSubtensor1_idx(self):
x, y, z = tensor.lscalars('xyz')
v = make_vector(x, y, z)
f = function([x, y, z], v[[0, 2]], mode=mode_opt)
prog = f.maker.fgraph.toposort()
assert len(prog) == 1
assert isinstance(prog[0].op, MakeVector)
assert len(prog[0].inputs) == 2
r = f(0, 1, 2)
assert r[0] == 0 and r[1] == 2
class test_local_subtensor_lift(unittest.TestCase): class test_local_subtensor_lift(unittest.TestCase):
def test0(self): def test0(self):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论