ONE - On-device Neural Engine
Loading...
Searching...
No Matches
luci::VerifyQuantizedNodeGranularity Class Referenceabstract

Verify the granualrity of quantized node. More...

#include <VerifyQuantizedNodeGranularity.h>

Collaboration diagram for luci::VerifyQuantizedNodeGranularity:

Static Public Member Functions

static std::shared_ptr< VerifyQuantizedNodeGranularitycreate (Granularity granularity)
 

Protected Member Functions

bool is_lwq (const loco::Node *node)
 

Additional Inherited Members

- Public Member Functions inherited from luci::CircleNodeVisitor< bool >
virtual ~CircleNodeVisitor ()=default
 
- Public Member Functions inherited from luci::CircleNodeVisitorBase< T >
virtual ~CircleNodeVisitorBase ()=default
 

Detailed Description

Verify the granualrity of quantized node.

Targets to verify

  • node's output (i.e., node itself)
  • node's inputs

Definition at line 46 of file VerifyQuantizedNodeGranularity.h.

Member Function Documentation

◆ create()

std::shared_ptr< VerifyQuantizedNodeGranularity > luci::VerifyQuantizedNodeGranularity::create ( Granularity  granularity)
static

Definition at line 28 of file VerifyQuantizedNodeGranularity.cpp.

29{
30 if (granularity == Granularity::ChannelWise)
31 return std::make_shared<VerifyQuantizedNodeChannelWiseGranularity>();
32 else if (granularity == Granularity::LayerWise)
33 return std::make_shared<VerifyQuantizedNodeLayerWiseGranularity>();
34 else
35 throw std::domain_error("Not supported Granularity type");
36}

Referenced by luci::QuantizedModelVerifier::verify().

◆ is_lwq()

bool luci::VerifyQuantizedNodeGranularity::is_lwq ( const loco::Node node)
inlineprotected

Definition at line 52 of file VerifyQuantizedNodeGranularity.h.

53 {
54 auto circle_node = loco::must_cast<const luci::CircleNode *>(node);
55
56 if (circle_node->quantparam() == nullptr)
57 return false;
58
59 if (circle_node->quantparam()->scale.size() != 1)
60 return false;
61
62 if (circle_node->quantparam()->zerop.size() != 1)
63 return false;
64
65 return true;
66 }

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