Skip to content

Commit fe2d590

Browse files
committed
fix bug
1 parent 142fac1 commit fe2d590

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

python/paddle/fluid/memory_optimization_transpiler.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,15 @@ def check_var_validity(block_desc, x, is_forward):
172172
block_desc, cache_var, is_forward).dtype()
173173
# TODO(qijun): actually, we should compare dtype_to_size[x_dtype]
174174
# and dtype_to_size[cache_dtype]
175-
if x_dtype == cache_dtype and PRINT_LOG:
176-
print(("Hit Cache !!!! cache pool index "
177-
"is %d, var name is %s, "
178-
"cached var name is %s, "
179-
"var shape is %s ") %
180-
(index, x, cache_var,
181-
str(cache_shape)))
175+
if x_dtype == cache_dtype:
176+
if PRINT_LOG:
177+
print(
178+
("Hit Cache !!!! cache pool index "
179+
"is %d, var name is %s, "
180+
"cached var name is %s, "
181+
"var shape is %s ") %
182+
(index, x, cache_var,
183+
str(cache_shape)))
182184
self.pool.pop(index)
183185
if x == cache_var:
184186
break

0 commit comments

Comments
 (0)