Skip to content

How about implement another Run() in framework::Executor #7610

@Xreki

Description

@Xreki

Suggested by @qingqing01 , we may implement another Run() in paddle/framework/executor.h which do the same things as the Run() of Python Executor.

def run(self,
program=None,
feed=None,
fetch_list=None,
feed_var_name='feed',
fetch_var_name='fetch',
scope=None,
return_numpy=True):

The interface maybe like and will do following things:

void Run(const ProgramDesc& program,
         Scope* scope,
         std::map<std::string, Tensor>& feeds,
         std::map<std::string, Tensor>& fetchs,
         std::string& feed_var_name="feed",
         std::string& fetch_var_name="fetch") {
  1. clone the program
  2. prepend feed_op
  3. set feed variables
  4. append fetch_op
  5. call Run(const ProgramDesc&, Scope*, int, bool create_local_scope = true, bool create_vars = true)
  6. get fetch variables 
}

So that we can directly Run both in Python API and C++ API.

Metadata

Metadata

Labels

预测原名Inference,包含Capi预测问题等

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions