@@ -215,15 +215,12 @@ def compare_shape(x_shape, cache_shape, opt_level):
215
215
# update skip set to meet users' demand
216
216
if skip_opt_set :
217
217
self ._skip_opt .update (skip_opt_set )
218
- # self.pool = []
219
218
for i in range (self .op_size ):
220
219
op = self ._ops [i ]
221
220
if op .type () in SUB_BLOCK_OPS :
222
221
continue
223
222
block_desc = op .block ()
224
223
is_forward = i < self ._forward_num
225
- self ._fill_pool (i , is_forward )
226
- # print(op.type(), i, self.pool)
227
224
if self .pool :
228
225
defs_can_optimize = [
229
226
x for x in self ._defs [i ]
@@ -238,8 +235,6 @@ def compare_shape(x_shape, cache_shape, opt_level):
238
235
raise ValueError ("x in pool" )
239
236
# If x is both in uses and defs, it can not be optimized!
240
237
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))
243
238
continue
244
239
for index , cache_pair in enumerate (self .pool ):
245
240
cache_var = cache_pair [0 ]
@@ -273,17 +268,9 @@ def compare_shape(x_shape, cache_shape, opt_level):
273
268
_rename_arg_ (self ._ops , x , cache_var , begin_idx = i )
274
269
self ._program .block (block_desc .id )._remove_var (cpt .to_text (
275
270
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)
284
271
self ._update_graph (x , cache_var , begin_idx = i )
285
272
break
286
- # self._fill_pool(i, is_forward)
273
+ self ._fill_pool (i , is_forward )
287
274
288
275
289
276
0 commit comments