提交 3a6cb99f authored 作者: Sigurd Spieckermann's avatar Sigurd Spieckermann

fixed AdvancedIncSubtensor[1] tests for local_incsubtensor_of_zeros optimization

上级 a8b2be1e
...@@ -2522,7 +2522,7 @@ class Test_alloc_zero(unittest.TestCase): ...@@ -2522,7 +2522,7 @@ class Test_alloc_zero(unittest.TestCase):
x = tensor.matrix() x = tensor.matrix()
y = tensor.matrix() y = tensor.matrix()
y0 = tensor.zeros_like(y) y0 = tensor.zeros_like(y)
z = tensor.inc_subtensor(x[[0, 1, 0, 1], [0, 0, 1, 1]], y0) z = tensor.inc_subtensor(x[[[0, 0], [1, 1]], [[0, 1], [0, 1]]], y0)
f = theano.function([x, y], z, mode=self.mode) f = theano.function([x, y], z, mode=self.mode)
assert numpy.all([not isinstance(x.op, tensor.AdvancedIncSubtensor) assert numpy.all([not isinstance(x.op, tensor.AdvancedIncSubtensor)
for x in f.maker.fgraph.toposort()]) for x in f.maker.fgraph.toposort()])
...@@ -2531,7 +2531,7 @@ class Test_alloc_zero(unittest.TestCase): ...@@ -2531,7 +2531,7 @@ class Test_alloc_zero(unittest.TestCase):
x = tensor.matrix() x = tensor.matrix()
y = tensor.matrix() y = tensor.matrix()
y0 = tensor.zeros_like(y) y0 = tensor.zeros_like(y)
z = tensor.inc_subtensor(x[[0, 1, 0, 1], [0, 0, 1, 1]], y0.T) z = tensor.inc_subtensor(x[[[0, 0], [1, 1]], [[0, 1], [0, 1]]], y0.T)
f = theano.function([x, y], z, mode=mode_opt) f = theano.function([x, y], z, mode=mode_opt)
assert numpy.all([not isinstance(x.op, tensor.AdvancedIncSubtensor) assert numpy.all([not isinstance(x.op, tensor.AdvancedIncSubtensor)
for x in f.maker.fgraph.toposort()]) for x in f.maker.fgraph.toposort()])
...@@ -2540,7 +2540,7 @@ class Test_alloc_zero(unittest.TestCase): ...@@ -2540,7 +2540,7 @@ class Test_alloc_zero(unittest.TestCase):
x = tensor.matrix() x = tensor.matrix()
y0 = tensor.constant(numpy.asarray(numpy.zeros_like((2, 2)), y0 = tensor.constant(numpy.asarray(numpy.zeros_like((2, 2)),
dtype=config.floatX)) dtype=config.floatX))
z = tensor.inc_subtensor(x[[0, 1, 0, 1], [0, 0, 1, 1]], y0) z = tensor.inc_subtensor(x[[[0, 0], [1, 1]], [[0, 1], [0, 1]]], y0)
f = theano.function([x], z, mode=self.mode) f = theano.function([x], z, mode=self.mode)
assert numpy.all([not isinstance(x.op, tensor.AdvancedIncSubtensor) assert numpy.all([not isinstance(x.op, tensor.AdvancedIncSubtensor)
for x in f.maker.fgraph.toposort()]) for x in f.maker.fgraph.toposort()])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论