Skip to content

Commit 873b517

Browse files
committed
"use simple stategy"
1 parent ef60a65 commit 873b517

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

python/paddle/fluid/transpiler/memory_optimization_transpiler.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,12 @@ def compare_shape(x_shape, cache_shape, opt_level):
215215
# update skip set to meet users' demand
216216
if skip_opt_set:
217217
self._skip_opt.update(skip_opt_set)
218-
# self.pool = []
219218
for i in range(self.op_size):
220219
op = self._ops[i]
221220
if op.type() in SUB_BLOCK_OPS:
222221
continue
223222
block_desc = op.block()
224223
is_forward = i < self._forward_num
225-
self._fill_pool(i, is_forward)
226-
# print(op.type(), i, self.pool)
227224
if self.pool:
228225
defs_can_optimize = [
229226
x for x in self._defs[i]
@@ -238,8 +235,6 @@ def compare_shape(x_shape, cache_shape, opt_level):
238235
raise ValueError("x in pool")
239236
# If x is both in uses and defs, it can not be optimized!
240237
if x in self._uses[i]:
241-
# print(self.pool, op.type(), cpt.to_text(x))
242-
# raise ValueError("x in use!", cpt.to_text(x))
243238
continue
244239
for index, cache_pair in enumerate(self.pool):
245240
cache_var = cache_pair[0]
@@ -273,17 +268,9 @@ def compare_shape(x_shape, cache_shape, opt_level):
273268
_rename_arg_(self._ops, x, cache_var, begin_idx=i)
274269
self._program.block(block_desc.id)._remove_var(cpt.to_text(
275270
x))
276-
# if str(self._program) != str(self._dup_program):
277-
# with open("./program_middle", "w") as f:
278-
# f.write(str(self._program))
279-
# f.flush()
280-
# exit(0)
281-
# self._program.block(block_desc.id).var(cpt.to_text(
282-
# x)).desc = self._find_var(block_desc, cache_var,
283-
# is_forward)
284271
self._update_graph(x, cache_var, begin_idx=i)
285272
break
286-
# self._fill_pool(i, is_forward)
273+
self._fill_pool(i, is_forward)
287274

288275

289276

0 commit comments

Comments
 (0)