Executor

Executor realizes a simple executor in which all operators will be executed in order. You can run Executor in a Python script. There are two kinds of executors in PaddlePaddle Fluid. One is single-thread executor which is the default option for Executor and the other is the parallel executor which is illustrated in Parallel Executor . The config of Executor and Parallel Executor is different, it may be a bit confusing for some users. To make the executor more facility, we introduce CompiledProgram , CompiledProgram is used to transform a program for various optimizations, and it can be run by Executor.

The logic of Executor is very simple. It is suggested to thoroughly run the model with Executor in debugging phase on one computer and then switch to mode of multiple devices or multiple computers to compute.

Executor receives a Place at construction, which can either be api_fluid_CPUPlace or api_fluid_CUDAPlace.

# First create the Executor.
place = fluid.CUDAPlace(0) if use_cuda else fluid.CPUPlace()
exe = fluid.Executor(place)

# Run the startup program once and only once.
exe.run(fluid.default_startup_program())

# Run the main program directly.
loss, = exe.run(fluid.default_main_program(),
                feed=feed_dict,
                fetch_list=[loss.name])

For simple example please refer to basics_fit_a_line

  • Related API :

System Message: WARNING/2 (/FluidDoc/docs/api_guides/low_level/executor_en.rst, line 31)

Bullet list ends without a blank line; unexpected unindent.

  • api_fluid_Executor