executor

Executor

class paddle.fluid.executor.Executor(place)
run(program=None, feed=None, fetch_list=None, feed_var_name='feed', fetch_var_name='fetch', scope=None, return_numpy=True, use_program_cache=False)

Run program by this Executor. Feed data by feed map, fetch result by fetch_list.

Python executor takes a program, add feed operators and fetch operators to this program according to feed map and fetch_list. Feed map provides input data for the program. fetch_list provides the variables(or names) that user want to get after program run. Note: the executor will run all operators in the program but not only the operators dependent by the fetch_list

Parameters:
  • program – the program that need to run, if not provied, then default_main_program will be used.
  • feed – feed variable map, e.g. {“image”: ImageData, “label”: LableData}
  • fetch_list – a list of variable or variable names that user want to get, run will return them according

to this list. :param feed_var_name: the name for the input variable of feed Operator. :param fetch_var_name: the name for the output variable of feed Operator. :param scope: the scope used to run this program, you can switch it to different scope. default is global_scope :param return_numpy: if convert the fetched tensor to numpy :param use_program_cache: set use_program_cache to true if program not changed compare to the last step. :return: result according to fetch_list.

global_scope

paddle.fluid.executor.global_scope()

scope_guard

paddle.fluid.executor.scope_guard(*args, **kwds)

switch_scope

paddle.fluid.executor.switch_scope(scope)