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

Method PredictorEngine

paddle/fluid/jit/engine/predictor_engine.cc:25–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23namespace jit {
24
25PredictorEngine::PredictorEngine(
26 const std::shared_ptr<FunctionInfo> &info,
27 const std::shared_ptr<VariableMap> &params_dict,
28 const Place &place)
29 : info_(info),
30 params_dict_(params_dict),
31 scope_(new framework::Scope()),
32 place_(place) {
33 utils::ShareParamsIntoScope(info_->ParamNames(), params_dict_, scope_.get());
34 VLOG(6) << framework::GenScopeTreeDebugInfo(scope_.get());
35
36 // TODO(Aurelius84): Expose AnalysisConfig to user.
37 AnalysisConfig config;
38 config.SetProgFile(info->ProgramFilePath());
39 if (phi::is_gpu_place(place_)) {
40 config.EnableUseGpu(100, place_.GetDeviceId());
41 } else if (phi::is_cpu_place(place_)) {
42 config.DisableGpu();
43 config.EnableONEDNN();
44 config.EnableOnednnInt8();
45 config.SetOnednnCacheCapacity(0);
46 }
47 config.SetSkipLoadParams(true);
48 config.SetApplyOptim(true);
49 config.SwitchIrOptim(true);
50
51 predictor_.reset(new AnalysisPredictor(config));
52
53 predictor_->Init(
54 scope_, std::make_shared<framework::ProgramDesc>(info_->ProgramDesc()));
55}
56
57PredictorEngine::PredictorEngine(
58 const std::shared_ptr<FunctionInfo> &info,

Callers

nothing calls this directly

Calls 15

ShareParamsIntoScopeFunction · 0.85
GenScopeTreeDebugInfoFunction · 0.85
is_gpu_placeFunction · 0.85
is_cpu_placeFunction · 0.85
SetProgFileMethod · 0.80
DisableGpuMethod · 0.80
SwitchIrOptimMethod · 0.80
getMethod · 0.45
EnableUseGpuMethod · 0.45
GetDeviceIdMethod · 0.45
EnableONEDNNMethod · 0.45
EnableOnednnInt8Method · 0.45

Tested by

no test coverage detected