Insert parameters into the module based on the input instructions and then update the map_ins to map the input to the parameter.
| 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. |
| 1080 | static 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 | |
| 1096 | void module::add_params(const std::vector<instruction_ref>& inputs, |
| 1097 | std::unordered_map<instruction_ref, instruction_ref>* map_ins, |
no test coverage detected