MCPcopy Create free account
hub / github.com/Samsung/ONE / resolve

Method resolve

compiler/circle-mpqsolver/src/pattern/PatternResolver.cpp:269–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267} // namespace
268
269std::map<luci::CircleNode *, LayerParam>
270Q8LayerNormWithQ16VarianceResolver::resolve(const luci::Module *module)
271{
272 if (!module)
273 {
274 throw std::runtime_error("No module for pattern resolving");
275 }
276
277 std::map<luci::CircleNode *, LayerParam> nodes_params;
278 for (size_t idx = 0; idx < module->size(); ++idx)
279 {
280 auto graph = module->graph(idx);
281
282 for (auto node : loco::active_nodes(loco::output_nodes(graph)))
283 {
284 auto const mul = dynamic_cast<luci::CircleMul *>(node);
285 if (!mul)
286 continue;
287
288 LayerNormPattern pattern(mul);
289 if (!pattern.matched())
290 continue;
291
292 // set quantization parameters of recognized pattern
293 for (auto q16_node : pattern.get_q16_nodes())
294 {
295 LayerParam param = {q16_node->name(), "int16", "channel"};
296 nodes_params[q16_node] = param;
297 }
298
299 for (auto q8_node : pattern.get_q8_nodes())
300 {
301 LayerParam param = {q8_node->name(), "uint8", "channel"};
302 nodes_params[q8_node] = param;
303 }
304 }
305 }
306
307 return nodes_params;
308}
309
310std::map<luci::CircleNode *, LayerParam>
311Q8SoftmaxWithQ16SubExpResolver::resolve(const luci::Module *module)

Callers 2

TESTFunction · 0.45
resolvePatternsMethod · 0.45

Calls 8

active_nodesFunction · 0.85
output_nodesFunction · 0.85
sizeMethod · 0.45
graphMethod · 0.45
matchedMethod · 0.45
get_q16_nodesMethod · 0.45
nameMethod · 0.45
get_q8_nodesMethod · 0.45

Tested by 1

TESTFunction · 0.36