hot fix the Native clone (#15344)

recover_files
Yan Chunwei 6 years ago committed by GitHub
parent 3ecf6bb338
commit b7916440ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -161,13 +161,14 @@ bool NativePaddlePredictor::Run(const std::vector<PaddleTensor> &inputs,
}
std::unique_ptr<PaddlePredictor> NativePaddlePredictor::Clone() {
VLOG(3) << "Predictor::clone";
std::unique_ptr<PaddlePredictor> cls(new NativePaddlePredictor(config_));
if (!dynamic_cast<NativePaddlePredictor *>(cls.get())->Init(scope_)) {
// Hot fix the bug that result diff in multi-thread.
// TODO(Superjomn) re-implement a real clone here.
if (!dynamic_cast<NativePaddlePredictor *>(cls.get())->Init(nullptr)) {
LOG(ERROR) << "fail to call Init";
return nullptr;
}
#ifdef __clang__
// fix clang compile error
return cls;

Loading…
Cancel
Save