| 192 | } |
| 193 | |
| 194 | const std::vector<std::string> ProgramDesc::GetFeedTargetNames() { |
| 195 | auto &global_block = Block(0); |
| 196 | // The order of feed_target_names must follow the index specified in `col`. |
| 197 | // since feed operator's order doesn't necessary follow 'col'. |
| 198 | std::vector<std::string> feed_target_names; |
| 199 | for (auto *op : global_block.AllOps()) { |
| 200 | if (op->Type() == kFeedOpType) { |
| 201 | size_t col = PADDLE_GET_CONST(int, op->GetAttr("col")); |
| 202 | if (col >= feed_target_names.size()) { |
| 203 | feed_target_names.resize(col + 1); |
| 204 | } |
| 205 | feed_target_names[col] = op->Output("Out")[0]; |
| 206 | } |
| 207 | } |
| 208 | return feed_target_names; |
| 209 | } |
| 210 | |
| 211 | const std::vector<std::string> ProgramDesc::GetFetchTargetNames() { |
| 212 | auto &global_block = Block(0); |