@@ -275,17 +275,6 @@ def run(self,
275
275
outputs = {'Out' : [out ]},
276
276
attrs = {'col' : i })
277
277
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
-
289
278
if not has_fetch_operators (global_block , fetch_list ,
290
279
fetch_var_name ):
291
280
for i , var in enumerate (fetch_list ):
@@ -297,6 +286,18 @@ def run(self,
297
286
outputs = {'Out' : [fetch_var ]},
298
287
attrs = {'col' : i })
299
288
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
+
300
301
self .executor .run (program_cache .desc , scope , 0 , True , True )
301
302
outs = [
302
303
core .get_fetch_variable (scope , fetch_var_name , i )
0 commit comments