MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / Clone

Method Clone

paddle/fluid/inference/api/api_impl.cc:185–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185std::unique_ptr<PaddlePredictor> NativePaddlePredictor::Clone(void *stream) {
186 std::lock_guard<std::mutex> lk(clone_mutex_);
187 VLOG(3) << "Predictor::clone";
188 std::unique_ptr<PaddlePredictor> cls(new NativePaddlePredictor(config_));
189 // Hot fix the bug that result diff in multi-thread.
190 // TODO(Superjomn) re-implement a real clone here.
191 PADDLE_ENFORCE_NOT_NULL(
192 dynamic_cast<NativePaddlePredictor *>(cls.get()),
193 common::errors::PreconditionNotMet(
194 "Dynamic_cast from PaddlePredictor to NativePaddlePredictor failed"));
195 if (!dynamic_cast<NativePaddlePredictor *>(cls.get())->Init(nullptr)) {
196 LOG(ERROR) << "fail to call Init";
197 return nullptr;
198 }
199 return cls;
200}
201
202bool NativePaddlePredictor::SetFeed(const std::vector<PaddleTensor> &inputs,
203 framework::Scope *scope) {

Callers 3

pd_predictor.ccFile · 0.45
TESTFunction · 0.45
MainThreadsFunction · 0.45

Calls 2

getMethod · 0.45
InitMethod · 0.45

Tested by 1

TESTFunction · 0.36