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

Method GetFetchTargetNames

paddle/fluid/framework/program_desc.cc:211–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209}
210
211const std::vector<std::string> ProgramDesc::GetFetchTargetNames() {
212 auto &global_block = Block(0);
213 // The order of fetch_target_names must follow the index specified in `col`.
214 // since fetch operator's order doesn't necessary follow 'col'.
215 std::vector<std::string> fetch_target_names;
216 for (auto *op : global_block.AllOps()) {
217 if (op->Type() == kFetchOpType) {
218 size_t col = PADDLE_GET_CONST(int, op->GetAttr("col"));
219 if (col >= fetch_target_names.size()) {
220 fetch_target_names.resize(col + 1);
221 }
222 fetch_target_names[col] = op->Input("X")[0];
223 }
224 }
225 return fetch_target_names;
226}
227
228void ProgramDesc::SetFeedHolderName(const std::string &feed_holder_name) {
229 auto *global_block = MutableBlock(0);

Callers 2

FunctionInfoMethod · 0.80
TestInferenceFunction · 0.80

Calls 8

PADDLE_GET_CONSTFunction · 0.85
AllOpsMethod · 0.80
BlockFunction · 0.70
TypeMethod · 0.45
GetAttrMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45
InputMethod · 0.45

Tested by 1

TestInferenceFunction · 0.64