From fe2d590d2102d97f95b1bdebd863b1d9cb34feac Mon Sep 17 00:00:00 2001 From: qiaolongfei Date: Wed, 7 Mar 2018 16:33:19 +0800 Subject: [PATCH] fix bug --- .../fluid/memory_optimization_transpiler.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/python/paddle/fluid/memory_optimization_transpiler.py b/python/paddle/fluid/memory_optimization_transpiler.py index e82456a99fc..4fa2d03ef56 100644 --- a/python/paddle/fluid/memory_optimization_transpiler.py +++ b/python/paddle/fluid/memory_optimization_transpiler.py @@ -172,13 +172,15 @@ class ControlFlowGraph(object): block_desc, cache_var, is_forward).dtype() # TODO(qijun): actually, we should compare dtype_to_size[x_dtype] # and dtype_to_size[cache_dtype] - if x_dtype == cache_dtype and PRINT_LOG: - print(("Hit Cache !!!! cache pool index " - "is %d, var name is %s, " - "cached var name is %s, " - "var shape is %s ") % - (index, x, cache_var, - str(cache_shape))) + if x_dtype == cache_dtype: + if PRINT_LOG: + print( + ("Hit Cache !!!! cache pool index " + "is %d, var name is %s, " + "cached var name is %s, " + "var shape is %s ") % + (index, x, cache_var, + str(cache_shape))) self.pool.pop(index) if x == cache_var: break -- GitLab