未验证 提交 44d72ceb 编写于 作者: W Wilber 提交者: GitHub

inference python api fix miss return (#46300)

上级 4b8d4ade
...@@ -546,11 +546,11 @@ void BindPaddlePredictor(py::module *m) { ...@@ -546,11 +546,11 @@ void BindPaddlePredictor(py::module *m) {
.def("get_input_names", &PaddlePredictor::GetInputNames) .def("get_input_names", &PaddlePredictor::GetInputNames)
.def("get_output_names", &PaddlePredictor::GetOutputNames) .def("get_output_names", &PaddlePredictor::GetOutputNames)
.def("zero_copy_run", &PaddlePredictor::ZeroCopyRun) .def("zero_copy_run", &PaddlePredictor::ZeroCopyRun)
.def("clone", [](PaddlePredictor &self) { self.Clone(nullptr); }) .def("clone", [](PaddlePredictor &self) { return self.Clone(nullptr); })
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) #if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
.def("clone", .def("clone",
[](PaddlePredictor &self, phi::CUDAStream &stream) { [](PaddlePredictor &self, phi::CUDAStream &stream) {
self.Clone(stream.raw_stream()); return self.Clone(stream.raw_stream());
}) })
#endif #endif
.def("get_serialized_program", &PaddlePredictor::GetSerializedProgram); .def("get_serialized_program", &PaddlePredictor::GetSerializedProgram);
...@@ -593,11 +593,12 @@ void BindNativePredictor(py::module *m) { ...@@ -593,11 +593,12 @@ void BindNativePredictor(py::module *m) {
.def("get_input_tensor", &NativePaddlePredictor::GetInputTensor) .def("get_input_tensor", &NativePaddlePredictor::GetInputTensor)
.def("get_output_tensor", &NativePaddlePredictor::GetOutputTensor) .def("get_output_tensor", &NativePaddlePredictor::GetOutputTensor)
.def("zero_copy_run", &NativePaddlePredictor::ZeroCopyRun) .def("zero_copy_run", &NativePaddlePredictor::ZeroCopyRun)
.def("clone", [](NativePaddlePredictor &self) { self.Clone(nullptr); }) .def("clone",
[](NativePaddlePredictor &self) { return self.Clone(nullptr); })
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) #if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
.def("clone", .def("clone",
[](NativePaddlePredictor &self, phi::CUDAStream &stream) { [](NativePaddlePredictor &self, phi::CUDAStream &stream) {
self.Clone(stream.raw_stream()); return self.Clone(stream.raw_stream());
}) })
#endif #endif
.def("scope", .def("scope",
...@@ -896,11 +897,11 @@ void BindAnalysisPredictor(py::module *m) { ...@@ -896,11 +897,11 @@ void BindAnalysisPredictor(py::module *m) {
.def("analysis_argument", .def("analysis_argument",
&AnalysisPredictor::analysis_argument, &AnalysisPredictor::analysis_argument,
py::return_value_policy::reference) py::return_value_policy::reference)
.def("clone", [](AnalysisPredictor &self) { self.Clone(nullptr); }) .def("clone", [](AnalysisPredictor &self) { return self.Clone(nullptr); })
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) #if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
.def("clone", .def("clone",
[](AnalysisPredictor &self, phi::CUDAStream &stream) { [](AnalysisPredictor &self, phi::CUDAStream &stream) {
self.Clone(stream.raw_stream()); return self.Clone(stream.raw_stream());
}) })
#endif #endif
.def("scope", .def("scope",
...@@ -929,11 +930,12 @@ void BindPaddleInferPredictor(py::module *m) { ...@@ -929,11 +930,12 @@ void BindPaddleInferPredictor(py::module *m) {
#endif #endif
self.Run(); self.Run();
}) })
.def("clone", [](paddle_infer::Predictor &self) { self.Clone(nullptr); }) .def("clone",
[](paddle_infer::Predictor &self) { return self.Clone(nullptr); })
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) #if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
.def("clone", .def("clone",
[](paddle_infer::Predictor &self, phi::CUDAStream &stream) { [](paddle_infer::Predictor &self, phi::CUDAStream &stream) {
self.Clone(stream.raw_stream()); return self.Clone(stream.raw_stream());
}) })
#endif #endif
.def("try_shrink_memory", &paddle_infer::Predictor::TryShrinkMemory) .def("try_shrink_memory", &paddle_infer::Predictor::TryShrinkMemory)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册