| 209 | } |
| 210 | |
| 211 | const 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 | |
| 228 | void ProgramDesc::SetFeedHolderName(const std::string &feed_holder_name) { |
| 229 | auto *global_block = MutableBlock(0); |