提交 9aa99867 authored 作者: nouiz's avatar nouiz

Merge pull request #581 from lamblin/test_alloc_opt

Check that Alloc nodes are not inserted during opt
......@@ -2244,6 +2244,19 @@ class Test_local_useless_alloc(unittest.TestCase):
if isinstance(mode_opt, compile.DebugMode):
self.assertRaises(ValueError, f)
def test1(self):
# Test that alloc never gets instantiated during optimization
mode = mode_opt.excluding('local_useless_alloc')
x = tensor.matrix('x')
xx = tensor.fill(x, x)
# The optimization 'locall_fill_to_alloc' should call tensor.alloc,
# which should return x and not alloc(x, ...)
f = function([x], [xx], mode=mode)
op_classes = [node.op.__class__ for node in f.maker.env.toposort()]
assert tensor.Alloc not in op_classes
class test_shapeoptimizer(unittest.TestCase):
def setUp(self):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论