提交 2015d28c authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Fixed crash in constant folding optimization

上级 2060b8f7
...@@ -3370,6 +3370,10 @@ class Alloc(gof.Op): ...@@ -3370,6 +3370,10 @@ class Alloc(gof.Op):
return self.make_node(eval_points[0], *inputs[1:]).outputs return self.make_node(eval_points[0], *inputs[1:]).outputs
def do_constant_folding(self, node): def do_constant_folding(self, node):
if not hasattr(node.outputs[0], 'clients'):
# If there are no clients then there is no point doing constant
# folding.
return False
for client in node.outputs[0].clients: for client in node.outputs[0].clients:
if client[0] == 'output': if client[0] == 'output':
# If the output is a constant, it will have to be deepcopied # If the output is a constant, it will have to be deepcopied
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论