ONE - On-device Neural Engine
Loading...
Searching...
No Matches
luci::ResolveCustomOpMaxPoolWithArgmaxPass Struct Referencefinal

Class to resolve custom op MaxPoolWithArgmax to subgraph with circle's MaxPool and ArgMax. More...

#include <ResolveCustomOpMaxPoolWithArgmaxPass.h>

Collaboration diagram for luci::ResolveCustomOpMaxPoolWithArgmaxPass:

Public Member Functions

const char * name (void) const final
 
bool run (loco::Graph *g) final
 
- Public Member Functions inherited from logo::Pass
virtual ~Pass ()=default
 

Detailed Description

Class to resolve custom op MaxPoolWithArgmax to subgraph with circle's MaxPool and ArgMax.

Definition at line 28 of file ResolveCustomOpMaxPoolWithArgmaxPass.h.

Member Function Documentation

◆ name()

const char * luci::ResolveCustomOpMaxPoolWithArgmaxPass::name ( void  ) const
inlinefinalvirtual

Reimplemented from logo::Pass.

Definition at line 30 of file ResolveCustomOpMaxPoolWithArgmaxPass.h.

30{ return "luci::ResolveCustomOpMaxPoolWithArgmaxPass"; }

◆ run()

bool luci::ResolveCustomOpMaxPoolWithArgmaxPass::run ( loco::Graph g)
finalvirtual

BEFORE | [CircleNode] | [CUSTOM(MaxPoolWithArgmax)] | | [MaxPool output] [Argmax output]

AFTER | [CircleNode] / \ [Split over channels] [MaxPool2D] / | \ \ [Requantize] ... ... [MaxPool output] | [PadV2] | [Conv2D] | [ArgMax] | [Reshape to 4d] | [Cast to float32] / | | [Mul 1/<window width>] | \ | [Floor] | | | [DepthwiseConv2D for requantize] | / \ | [Mul window width] | \ / / \ [Neg] [Mul input width] \ / / [Add] / \ / [Add] | [Add const] | [Mul number of channels] \ [Optional Add with channels id] ... ... \ | / [Concatenation] | [Cast to int] | [Argmax output]

Implements logo::Pass.

Definition at line 884 of file ResolveCustomOpMaxPoolWithArgmaxPass.cpp.

885{
886 bool changed = false;
887 for (auto node : loco::active_nodes(loco::output_nodes(g)))
888 {
889 auto cop = dynamic_cast<luci::CircleCustom *>(node);
890 if (not cop)
891 continue;
892
893 if (cop->custom_code() != "MaxPoolWithArgmax")
894 continue;
895
896 if (!resolve_max_pool_with_argmax(cop))
897 continue;
898
899 changed = true;
900 }
901
902 return changed;
903}
CUSTOM in Circle.
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(), and loco::output_nodes().

Referenced by package.infer.session::inference().


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