diff --git a/paddle/fluid/pybind/pybind.cc b/paddle/fluid/pybind/pybind.cc index 4fac04c5999712a14807861309ebff7190f584a5..b589b6af60546443bf73a9237e7e49990bd6b2af 100644 --- a/paddle/fluid/pybind/pybind.cc +++ b/paddle/fluid/pybind/pybind.cc @@ -621,13 +621,14 @@ All parameter, weight, gradient are variables in Paddle. [](ExecutionStrategy &self, size_t num_iteration_per_drop_scope) { self.num_iteration_per_drop_scope_ = num_iteration_per_drop_scope; }); - py::enum_(exec_strategy, "ExecutorType") - .value("Default", ExecutionStrategy::kDefault) - .value("Experimental", ExecutionStrategy::kExperimental); exec_strategy.def_property( - "type", [](const ExecutionStrategy &self) { return self.type_; }, - [](ExecutionStrategy &self, ExecutionStrategy::ExecutorType type) { - self.type_ = type; + "use_experimental_executor", + [](const ExecutionStrategy &self) { + return self.type_ == ExecutionStrategy::kExperimental; + }, + [](ExecutionStrategy &self, bool experimental) { + self.type_ = experimental ? ExecutionStrategy::kExperimental + : ExecutionStrategy::kDefault; }); py::class_ build_strategy(pe, "BuildStrategy"); diff --git a/python/paddle/fluid/tests/unittests/parallel_executor_test_base.py b/python/paddle/fluid/tests/unittests/parallel_executor_test_base.py index 30f74c8ebcebd1824cf147ec61f1ada6eb73b513..d3d739a6a8ffe201de189aebcf33c20f484f4175 100644 --- a/python/paddle/fluid/tests/unittests/parallel_executor_test_base.py +++ b/python/paddle/fluid/tests/unittests/parallel_executor_test_base.py @@ -71,7 +71,7 @@ class TestParallelExecutorBase(unittest.TestCase): exec_strategy = fluid.ExecutionStrategy() exec_strategy.allow_op_delay = allow_op_delay if use_fast_executor: - exec_strategy.type = fluid.ExecutionStrategy.ExecutorType.Experimental + exec_strategy.use_experimental_executor = True build_strategy = fluid.BuildStrategy() build_strategy.reduce_strategy = fluid.BuildStrategy.ReduceStrategy.Reduce \