From 0020d915063eda3ff641f50d0e0fca8f44fce552 Mon Sep 17 00:00:00 2001 From: Wilber Date: Thu, 18 Feb 2021 22:34:43 -0600 Subject: [PATCH] fix python pass builder error. (#30946) --- paddle/fluid/pybind/inference_api.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/pybind/inference_api.cc b/paddle/fluid/pybind/inference_api.cc index 3c6d1926d1..dd9cb65142 100644 --- a/paddle/fluid/pybind/inference_api.cc +++ b/paddle/fluid/pybind/inference_api.cc @@ -543,7 +543,10 @@ void BindAnalysisConfig(py::module *m) { [](AnalysisConfig &self, const std::string &pass) { self.pass_builder()->DeletePass(pass); }) - .def("pass_builder", &AnalysisConfig::pass_builder, + .def("pass_builder", + [](AnalysisConfig &self) { + return dynamic_cast(self.pass_builder()); + }, py::return_value_policy::reference); } -- GitLab