Skip to content

Commit 0876fc1

Browse files
committed
fix feed var
1 parent 4977d99 commit 0876fc1

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

python/paddle/fluid/executor.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -275,17 +275,6 @@ def run(self,
275275
outputs={'Out': [out]},
276276
attrs={'col': i})
277277

278-
for op in global_block.ops:
279-
if op.desc.type() == 'feed':
280-
feed_target_name = op.desc.output('Out')[0]
281-
cur_feed = feed[feed_target_name]
282-
if not isinstance(cur_feed, core.LoDTensor):
283-
cur_feed = self.aslodtensor(cur_feed)
284-
idx = op.desc.attr('col')
285-
core.set_feed_variable(scope, cur_feed, feed_var_name, idx)
286-
else:
287-
break
288-
289278
if not has_fetch_operators(global_block, fetch_list,
290279
fetch_var_name):
291280
for i, var in enumerate(fetch_list):
@@ -297,6 +286,18 @@ def run(self,
297286
outputs={'Out': [fetch_var]},
298287
attrs={'col': i})
299288

289+
# feed var to framework
290+
for op in program_cache.global_block().ops:
291+
if op.desc.type() == 'feed':
292+
feed_target_name = op.desc.output('Out')[0]
293+
cur_feed = feed[feed_target_name]
294+
if not isinstance(cur_feed, core.LoDTensor):
295+
cur_feed = self.aslodtensor(cur_feed)
296+
idx = op.desc.attr('col')
297+
core.set_feed_variable(scope, cur_feed, feed_var_name, idx)
298+
else:
299+
break
300+
300301
self.executor.run(program_cache.desc, scope, 0, True, True)
301302
outs = [
302303
core.get_fetch_variable(scope, fetch_var_name, i)

0 commit comments

Comments
 (0)