From c509c82546240d5a08584738792546a4e6536084 Mon Sep 17 00:00:00 2001 From: QI JUN Date: Fri, 25 May 2018 11:39:29 +0800 Subject: [PATCH] Fix range in data flow analysis (#10865) * fix range in data flow analysis --- .../paddle/fluid/transpiler/memory_optimization_transpiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/paddle/fluid/transpiler/memory_optimization_transpiler.py b/python/paddle/fluid/transpiler/memory_optimization_transpiler.py index 80a8f7c09cf..9ff0ae6fca2 100644 --- a/python/paddle/fluid/transpiler/memory_optimization_transpiler.py +++ b/python/paddle/fluid/transpiler/memory_optimization_transpiler.py @@ -107,7 +107,7 @@ class ControlFlowGraph(object): # Repeatedly apply liveness updates until the algorithm stablize # on a complete set live input vars and live output vars. while True: - for i in range(self.op_size, 0, -1): + for i in reversed(range(self.op_size)): live_in[i] = set(self._live_in[i]) live_out[i] = set(self._live_out[i]) for s in self._successors[i]: -- GitLab