From d1d825ee02f86aa69e45e61525e575f6d3674151 Mon Sep 17 00:00:00 2001 From: yuyang18 Date: Wed, 15 Aug 2018 16:36:36 +0800 Subject: [PATCH] Hide unnecessary API --- paddle/fluid/pybind/pybind.cc | 13 +++++++------ .../tests/unittests/parallel_executor_test_base.py | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/paddle/fluid/pybind/pybind.cc b/paddle/fluid/pybind/pybind.cc index 4fac04c599..b589b6af60 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 30f74c8ebc..d3d739a6a8 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 \ -- GitLab