提交 e5216440 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Use the maximum graph size in max_use_ratio

Instead of using current size of the graph, use the size the graph had at its largest. This enables optimizations like constant-folding to reduce greatly the total number of nodes in the graph without triggering an error.
上级 148a5819
......@@ -1113,6 +1113,7 @@ class EquilibriumOptimizer(NavigatorOptimizer):
max_use_abort = False
opt_name = None
process_count = {}
max_nb_nodes = 0
while changed and not max_use_abort:
changed = False
......@@ -1130,7 +1131,8 @@ class EquilibriumOptimizer(NavigatorOptimizer):
q = deque(graph.io_toposort(env.inputs, start_from))
max_use = len(q) * self.max_use_ratio
max_nb_nodes = max(max_nb_nodes, len(q))
max_use = max_nb_nodes * self.max_use_ratio
def importer(node):
if node is not current_node:
q.append(node)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论