ONE - On-device Neural Engine
Loading...
Searching...
No Matches
mpqsolver::pattern::Q8SoftmaxWithQ16SubExpResolver Class Reference

#include <PatternResolver.h>

Collaboration diagram for mpqsolver::pattern::Q8SoftmaxWithQ16SubExpResolver:

Public Member Functions

std::map< luci::CircleNode *, luci::CircleQuantizer::Options::LayerParamresolve (const luci::Module *module) override
 resolve all nodes of Softmax pattern as prescribed
 
- Public Member Functions inherited from mpqsolver::pattern::PatternResolver
virtual ~PatternResolver ()=default
 

Detailed Description

Definition at line 49 of file PatternResolver.h.

Member Function Documentation

◆ resolve()

std::map< luci::CircleNode *, LayerParam > Q8SoftmaxWithQ16SubExpResolver::resolve ( const luci::Module module)
overridevirtual

resolve all nodes of Softmax pattern as prescribed

Implements mpqsolver::pattern::PatternResolver.

Definition at line 311 of file PatternResolver.cpp.

312{
313 if (!module)
314 {
315 throw std::runtime_error("No module for pattern resolving");
316 }
317
318 std::map<luci::CircleNode *, LayerParam> nodes_params;
319 for (size_t idx = 0; idx < module->size(); ++idx)
320 {
321 auto graph = module->graph(idx);
322
323 for (auto node : loco::active_nodes(loco::output_nodes(graph)))
324 {
325 auto const div = dynamic_cast<luci::CircleDiv *>(node);
326 if (!div)
327 continue;
328
329 SoftmaxPattern pattern(div);
330 if (!pattern.matched())
331 continue;
332
333 // set quantization parameters of recognized pattern
334 for (auto q16_node : pattern.get_q16_nodes())
335 {
336 LayerParam param = {q16_node->name(), "int16", "channel"};
337 nodes_params[q16_node] = param;
338 }
339
340 for (auto q8_node : pattern.get_q8_nodes())
341 {
342 LayerParam param = {q8_node->name(), "uint8", "channel"};
343 nodes_params[q8_node] = param;
344 }
345 }
346 }
347
348 return nodes_params;
349}
DIV in Circle.
Definition CircleDiv.h:37
std::set< loco::Node * > active_nodes(const std::vector< loco::Node * > &roots)
Enumerate all the nodes required to compute "roots".
std::vector< Node * > output_nodes(Graph *)
Definition Graph.cpp:101

References loco::active_nodes(), luci::CircleQuantizer::Options::LayerParam::name, and loco::output_nodes().


The documentation for this class was generated from the following files: