ONE - On-device Neural Engine
Loading...
Searching...
No Matches
luci::CircleTypeInferencePass Class Reference

Pass to infer type of circle nodes. More...

#include <CircleTypeInferencePass.h>

Collaboration diagram for luci::CircleTypeInferencePass:

Public Member Functions

virtual const charname (void) const
 
bool run (luci::Module *m)
 
bool run (loco::Graph *g)
 Run the pass.
 
- Public Member Functions inherited from luci::Pass
bool run (loco::Graph *) override
 Run the pass.
 
bool run (luci::Module *) override
 
- Public Member Functions inherited from logo::Pass
virtual ~Pass ()=default
 

Detailed Description

Pass to infer type of circle nodes.

Definition at line 30 of file CircleTypeInferencePass.h.

Member Function Documentation

◆ name()

virtual const char * luci::CircleTypeInferencePass::name ( void  ) const
inlinevirtual

Reimplemented from logo::Pass.

Definition at line 33 of file CircleTypeInferencePass.h.

33{ return "luci::CircleTypeInferencePass"; }

◆ run() [1/2]

bool luci::CircleTypeInferencePass::run ( loco::Graph graph)
virtual

Run the pass.

Returns
false if there was nothing changed

Implements logo::Pass.

Definition at line 41 of file CircleTypeInferencePass.cpp.

42{
44 bool changed = false;
45
46 for (auto node : inference_candidates(g))
47 {
50
51 if (type_infer_rule.infer(circle_node, dtype) && circle_node->dtype() != dtype)
52 {
53 circle_node->dtype(dtype);
54 changed = true;
55 }
56 }
57
58 return changed;
59}
T must_cast(FeatureEncoder *node)
A helper dynamic_cast that throws when failed.
DataType
"scalar" value type
Definition DataType.h:27
T must_cast(loco::Node *node)
std::vector< loco::Node * > inference_candidates(loco::Graph *g)
Enumerate all the nodes whose shape/dtype should be inferenced to export graph.

References luci::inference_candidates(), loco::must_cast(), and luci::must_cast().

◆ run() [2/2]

bool luci::CircleTypeInferencePass::run ( luci::Module m)
virtual

Implements luci::ModulePass.

Definition at line 28 of file CircleTypeInferencePass.cpp.

29{
30 bool changed = false;
31
32 for (size_t g = 0; g < m->size(); ++g)
33 {
34 if (run(m->graph(g)))
35 changed = true;
36 }
37
38 return changed;
39}

References m, and run().

Referenced by run().


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