| 54 | |
| 55 | template <class F> |
| 56 | static std::vector<instruction_ref> |
| 57 | find_inputs_impl(const std::unordered_map<instruction_ref, instruction_ref>& map_ins, |
| 58 | const_module_ref sub, |
| 59 | F parent_has) |
| 60 | { |
| 61 | std::vector<instruction_ref> result; |
| 62 | std::map<std::string, instruction_ref> names; |
| 63 | for(auto&& [input, param] : map_ins) |
| 64 | { |
| 65 | if(sub != nullptr and not sub->has_instruction(param)) |
| 66 | continue; |
| 67 | if(param->name() != "@param") |
| 68 | continue; |
| 69 | if(not parent_has(input)) |
| 70 | continue; |
| 71 | auto v = param->get_operator().to_value(); |
| 72 | auto name = v.at("parameter").template to<std::string>(); |
| 73 | names[name] = input; |
| 74 | } |
| 75 | std::transform(names.begin(), names.end(), std::back_inserter(result), [](const auto& p) { |
| 76 | return p.second; |
| 77 | }); |
| 78 | assert(not sub or result.size() == sub->get_parameter_shapes().size()); |
| 79 | return result; |
| 80 | } |
| 81 | |
| 82 | std::vector<instruction_ref> |
| 83 | find_inputs(const std::unordered_map<instruction_ref, instruction_ref>& map_ins, |
no test coverage detected