Skip to content

Commit 47d9f64

Browse files
committed
PaddlePredictorImpl::Clone return unique_ptr
1 parent ad0bebd commit 47d9f64

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

paddle/contrib/inference/paddle_inference_api_impl.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,11 @@ bool PaddlePredictorImpl::Run(const std::vector<PaddleTensor> &inputs,
135135

136136
std::unique_ptr<PaddlePredictor> PaddlePredictorImpl::Clone() {
137137
VLOG(3) << "Predictor::clone";
138-
std::unique_ptr<PaddlePredictor> cls(new PaddlePredictorImpl(config_));
138+
std::unique_ptr<PaddlePredictor> cls(nullptr);
139139
if (!cls->InitShared()) {
140140
LOG(ERROR) << "fail to call InitShared";
141-
return nullptr;
141+
} else {
142+
cls.reset(new PaddlePredictorImpl(config_));
142143
}
143144
// fix manylinux compile error.
144145
return cls;

0 commit comments

Comments
 (0)