@@ -226,15 +226,15 @@ static bool has_fetch_operators(
226
226
}
227
227
228
228
void Executor::Run (const ProgramDesc& program, Scope* scope,
229
- std::map<std::string, const LoDTensor*>& feed_targets,
230
- std::map<std::string, LoDTensor*>& fetch_targets,
229
+ std::map<std::string, const LoDTensor*>* feed_targets,
230
+ std::map<std::string, LoDTensor*>* fetch_targets,
231
231
bool create_vars, const std::string& feed_holder_name,
232
232
const std::string& fetch_holder_name) {
233
233
platform::RecordBlock b (kProgramId );
234
234
bool has_feed_ops =
235
- has_feed_operators (program.Block (0 ), feed_targets, feed_holder_name);
235
+ has_feed_operators (program.Block (0 ), * feed_targets, feed_holder_name);
236
236
bool has_fetch_ops =
237
- has_fetch_operators (program.Block (0 ), fetch_targets, fetch_holder_name);
237
+ has_fetch_operators (program.Block (0 ), * fetch_targets, fetch_holder_name);
238
238
239
239
ProgramDesc* copy_program = const_cast <ProgramDesc*>(&program);
240
240
if (!has_feed_ops || !has_fetch_ops) {
@@ -250,7 +250,7 @@ void Executor::Run(const ProgramDesc& program, Scope* scope,
250
250
feed_holder->SetPersistable (true );
251
251
252
252
int i = 0 ;
253
- for (auto & feed_target : feed_targets) {
253
+ for (auto & feed_target : (* feed_targets) ) {
254
254
std::string var_name = feed_target.first ;
255
255
VLOG (3 ) << " feed target's name: " << var_name;
256
256
@@ -273,7 +273,7 @@ void Executor::Run(const ProgramDesc& program, Scope* scope,
273
273
fetch_holder->SetPersistable (true );
274
274
275
275
int i = 0 ;
276
- for (auto & fetch_target : fetch_targets) {
276
+ for (auto & fetch_target : (* fetch_targets) ) {
277
277
std::string var_name = fetch_target.first ;
278
278
VLOG (3 ) << " fetch target's name: " << var_name;
279
279
@@ -361,25 +361,25 @@ void Executor::RunPreparedContext(ExecutorPrepareContext* ctx, Scope* scope,
361
361
362
362
void Executor::RunPreparedContext (
363
363
ExecutorPrepareContext* ctx, Scope* scope,
364
- std::map<std::string, const LoDTensor*>& feed_targets,
365
- std::map<std::string, LoDTensor*>& fetch_targets, bool create_vars,
364
+ std::map<std::string, const LoDTensor*>* feed_targets,
365
+ std::map<std::string, LoDTensor*>* fetch_targets, bool create_vars,
366
366
const std::string& feed_holder_name, const std::string& fetch_holder_name) {
367
367
auto & global_block = ctx->prog_ .Block (ctx->block_id_ );
368
368
369
369
PADDLE_ENFORCE (
370
- has_feed_operators (global_block, feed_targets, feed_holder_name),
370
+ has_feed_operators (global_block, * feed_targets, feed_holder_name),
371
371
" Program in ExecutorPrepareContext should has feed_ops." );
372
372
PADDLE_ENFORCE (
373
- has_fetch_operators (global_block, fetch_targets, fetch_holder_name),
373
+ has_fetch_operators (global_block, * fetch_targets, fetch_holder_name),
374
374
" Program in the prepared context should has fetch_ops." );
375
375
376
376
// map the data of feed_targets to feed_holder
377
377
for (auto * op : global_block.AllOps ()) {
378
378
if (op->Type () == kFeedOpType ) {
379
379
std::string feed_target_name = op->Output (" Out" )[0 ];
380
380
int idx = boost::get<int >(op->GetAttr (" col" ));
381
- SetFeedVariable (scope, *feed_targets[feed_target_name], feed_holder_name ,
382
- idx);
381
+ SetFeedVariable (scope, *(* feed_targets) [feed_target_name],
382
+ feed_holder_name, idx);
383
383
}
384
384
}
385
385
@@ -390,7 +390,7 @@ void Executor::RunPreparedContext(
390
390
if (op->Type () == kFetchOpType ) {
391
391
std::string fetch_target_name = op->Input (" X" )[0 ];
392
392
int idx = boost::get<int >(op->GetAttr (" col" ));
393
- *fetch_targets[fetch_target_name] =
393
+ *(* fetch_targets) [fetch_target_name] =
394
394
GetFetchVariable (*scope, fetch_holder_name, idx);
395
395
}
396
396
}
0 commit comments