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

Function insert_params

src/module.cpp:1080–1094  ·  view source on GitHub ↗

Insert parameters into the module based on the input instructions and then update the map_ins to map the input to the parameter.

Source from the content-addressed store, hash-verified

1078// Insert parameters into the module based on the input instructions and then
1079// update the map_ins to map the input to the parameter.
1080static void insert_params(module& m,
1081 const std::vector<instruction_ref>& inputs,
1082 std::unordered_map<instruction_ref, instruction_ref>& map_ins,
1083 const std::function<shape(const shape&)>& shape_transform = nullptr)
1084{
1085 auto n = m.get_parameter_shapes().size();
1086 for(auto input : inputs)
1087 {
1088 if(contains(map_ins, input))
1089 continue;
1090 auto s = shape_transform ? shape_transform(input->get_shape())
1091 : input->get_shape().as_standard();
1092 map_ins[input] = m.add_parameter(param_name(n++), s);
1093 }
1094}
1095
1096void module::add_params(const std::vector<instruction_ref>& inputs,
1097 std::unordered_map<instruction_ref, instruction_ref>* map_ins,

Callers 2

add_paramsMethod · 0.85
fuseMethod · 0.85

Calls 7

containsFunction · 0.85
param_nameFunction · 0.85
as_standardMethod · 0.80
add_parameterMethod · 0.80
sizeMethod · 0.45
get_parameter_shapesMethod · 0.45
get_shapeMethod · 0.45

Tested by

no test coverage detected