ONE - On-device Neural Engine
Loading...
Searching...
No Matches
locoex::CircleTypeInferenceRule Struct Referencefinal

Type Inference Rule for CircleDialect. More...

#include <CircleTypeInferenceRule.h>

Collaboration diagram for locoex::CircleTypeInferenceRule:

Public Member Functions

bool recognize (const loco::Dialect *) const final
 Return true if this rule recognizes a given dialect.
 
bool infer (const loco::Node *, loco::DataType &) const final
 
- Public Member Functions inherited from loco::TypeInferenceRule
virtual ~TypeInferenceRule ()=default
 

Detailed Description

Type Inference Rule for CircleDialect.

Definition at line 28 of file CircleTypeInferenceRule.h.

Member Function Documentation

◆ infer()

bool locoex::CircleTypeInferenceRule::infer ( const loco::Node ,
loco::DataType  
) const
finalvirtual

Framework guarantees the followings:

  1. Framework tries to infer the data type of each node only after the data type of all of its valid (= non-nullptr) argument nodes is inferred.
  2. The result of preceding "infer" is accessible through below dtype_get method.
    • This holds only when preceding "infer" returns true.

Implements loco::TypeInferenceRule.

Definition at line 46 of file CircleTypeInferenceRule.cpp.

47{
48 assert(node->dialect() == CircleDialect::get());
49
50 TypeInferenceAlgorithm alg;
51
52 dtype = loco::must_cast<const CircleNode *>(node)->accept(&alg);
53 assert(dtype != loco::DataType::Unknown);
54
55 return true;
56}
static loco::Dialect * get(void)

References loco::Node::dialect(), and locoex::CircleDialect::get().

◆ recognize()

bool locoex::CircleTypeInferenceRule::recognize ( const loco::Dialect ) const
finalvirtual

Return true if this rule recognizes a given dialect.

Implements loco::TypeInferenceRule.

Definition at line 41 of file CircleTypeInferenceRule.cpp.

42{
43 return CircleDialect::get() == d;
44}

References locoex::CircleDialect::get().


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