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

Function ShareParamsIntoScope

paddle/fluid/jit/function_utils.cc:70–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70void ShareParamsIntoScope(const std::vector<std::string> &param_names,
71 const std::shared_ptr<VariableMap> &params_dict,
72 framework::Scope *scope) {
73 for (auto name : param_names) {
74 PADDLE_ENFORCE_EQ(params_dict->count(name),
75 1,
76 common::errors::InvalidArgument(
77 "Parameter named %s is not existed in params_dict. "
78 "Please check that your model was saved correctly",
79 name));
80
81 auto &param = params_dict->find(name)->second;
82 auto &dense_tensor = param->Get<DenseTensor>();
83 auto *var = scope->Var(name);
84 auto *dst_tensor = var->GetMutable<DenseTensor>();
85 *dst_tensor = dense_tensor;
86 }
87}
88
89void RemoveFeedFetch(framework::ProgramDesc *program_desc) {
90 for (size_t i = 0; i < program_desc->Size(); ++i) {

Callers 3

PirInterpreterEngineMethod · 0.85
PredictorEngineMethod · 0.85
InterpreterEngineMethod · 0.85

Calls 3

countMethod · 0.45
findMethod · 0.45
VarMethod · 0.45

Tested by

no test coverage detected