| 325 | } |
| 326 | |
| 327 | std::vector<std::string> Optimizer::GetMergeOpInfo( |
| 328 | const std::string& op_name, int32_t output_idx, |
| 329 | int32_t pre_op_output_num) { |
| 330 | std::string key; |
| 331 | if (op_name == "API_GET_P") { |
| 332 | if (output_idx % 2 == 0) { |
| 333 | key = ToString(op_name, ":even"); |
| 334 | } else { |
| 335 | key = ToString(op_name, ":odd"); |
| 336 | } |
| 337 | } else { |
| 338 | key = ToString(op_name, ":", output_idx); |
| 339 | } |
| 340 | std::string value = graph_part_mode_merge_map_[key]; |
| 341 | if (value.empty()) { |
| 342 | EULER_LOG(FATAL) << op_name << ":" << output_idx << " merge op error"; |
| 343 | } |
| 344 | std::vector<std::string> result = Split(value, ':'); |
| 345 | std::vector<std::string> input_list = Split(result[2], ','); |
| 346 | std::vector<std::string> input_id_list; |
| 347 | input_id_list.reserve(input_list.size()); |
| 348 | for (const std::string& input : input_list) { |
| 349 | if (input == "even" || input == "odd") { |
| 350 | input_id_list.push_back(ToString(pre_op_output_num + output_idx)); |
| 351 | } else { |
| 352 | input_id_list.push_back(ToString(pre_op_output_num + |
| 353 | atoi(input.c_str()))); |
| 354 | } |
| 355 | } |
| 356 | result[2] = Join(input_id_list, ","); |
| 357 | return result; |
| 358 | } |
| 359 | |
| 360 | std::vector<std::vector<std::string>> |
| 361 | Optimizer::ProduceMergeOpInfo( |