MCPcopy Create free account
hub / github.com/alibaba/euler / GetMergeOpInfo

Method GetMergeOpInfo

euler/parser/optimizer.cc:327–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325}
326
327std::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
360std::vector<std::vector<std::string>>
361Optimizer::ProduceMergeOpInfo(

Callers

nothing calls this directly

Calls 5

ToStringFunction · 0.85
SplitFunction · 0.85
JoinFunction · 0.85
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected