MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / find_inputs_impl

Function find_inputs_impl

src/param_utils.cpp:56–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54
55template <class F>
56static std::vector<instruction_ref>
57find_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
82std::vector<instruction_ref>
83find_inputs(const std::unordered_map<instruction_ref, instruction_ref>& map_ins,

Callers 1

find_inputsFunction · 0.85

Calls 9

atMethod · 0.80
transformFunction · 0.50
has_instructionMethod · 0.45
nameMethod · 0.45
to_valueMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
get_parameter_shapesMethod · 0.45

Tested by

no test coverage detected