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

Type Inference Rule for CircleDialect. More...

#include <CircleTypeInferenceRule.h>

Collaboration diagram for luci::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 luci::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 718 of file CircleTypeInferenceRule.cpp.

719{
720 assert(node->dialect() == CircleDialect::get());
721
722 TypeInferenceAlgorithm alg;
723
724 auto circle_node = loco::must_cast<const CircleNode *>(node);
725 dtype = circle_node->accept(&alg);
726 assert(dtype != loco::DataType::Unknown);
727
728 return true;
729}
static loco::Dialect * get(void)

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

Referenced by luci::tinf::Algorithm::visit().

◆ recognize()

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

Return true if this rule recognizes a given dialect.

Implements loco::TypeInferenceRule.

Definition at line 713 of file CircleTypeInferenceRule.cpp.

714{
715 return CircleDialect::get() == d;
716}

References luci::CircleDialect::get().


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