From 47d9f64ff7a756606fdc0e600366178eb96ed694 Mon Sep 17 00:00:00 2001 From: qiaolongfei Date: Wed, 30 May 2018 15:11:32 +0800 Subject: [PATCH] PaddlePredictorImpl::Clone return unique_ptr --- paddle/contrib/inference/paddle_inference_api_impl.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/paddle/contrib/inference/paddle_inference_api_impl.cc b/paddle/contrib/inference/paddle_inference_api_impl.cc index 349bd3b4036..bf510620eb1 100644 --- a/paddle/contrib/inference/paddle_inference_api_impl.cc +++ b/paddle/contrib/inference/paddle_inference_api_impl.cc @@ -135,10 +135,11 @@ bool PaddlePredictorImpl::Run(const std::vector &inputs, std::unique_ptr PaddlePredictorImpl::Clone() { VLOG(3) << "Predictor::clone"; - std::unique_ptr cls(new PaddlePredictorImpl(config_)); + std::unique_ptr cls(nullptr); if (!cls->InitShared()) { LOG(ERROR) << "fail to call InitShared"; - return nullptr; + } else { + cls.reset(new PaddlePredictorImpl(config_)); } // fix manylinux compile error. return cls; -- GitLab