ONE - On-device Neural Engine
Loading...
Searching...
No Matches
loco::ShapeInferenceRule Struct Referenceabstract

#include <ShapeInferenceRule.h>

Data Structures

struct  Context
 
struct  Sink
 

Public Types

enum class  API { V1 , V2 }
 

Public Member Functions

virtual ~ShapeInferenceRule ()=default
 
virtual bool support (const API &api) const
 Check whether a given API is available or not.
 
virtual bool recognize (const Dialect *) const =0
 Return true if this rule recognizes a given dialect.
 
virtual bool infer (const Node *, NodeShape &) const =0
 Infer node's shape.
 
virtual void infer (const Context *, const Node *, Sink *) const
 

Detailed Description

Definition at line 28 of file ShapeInferenceRule.h.

Member Enumeration Documentation

◆ API

enum class loco::ShapeInferenceRule::API
strong
Enumerator
V1 

API v1

This API uses "shape_get" method to query the shape of other nodes.

V2 

API v2

This API uses a given context (defined below) to query the shape of other nodes.

Definition at line 32 of file ShapeInferenceRule.h.

Constructor & Destructor Documentation

◆ ~ShapeInferenceRule()

virtual loco::ShapeInferenceRule::~ShapeInferenceRule ( )
virtualdefault

Member Function Documentation

◆ infer() [1/2]

void loco::ShapeInferenceRule::infer ( const Context ,
const Node ,
Sink  
) const
virtual

Reimplemented in moco::TFShapeInferenceRule, and loco::CanonicalShapeInferenceRule.

Definition at line 26 of file ShapeInferenceRule.cpp.

27{
28 throw std::runtime_error{"API v2 is not supported"};
29}

◆ infer() [2/2]

virtual bool loco::ShapeInferenceRule::infer ( const Node ,
NodeShape  
) const
pure virtual

◆ recognize()

◆ support()

virtual bool loco::ShapeInferenceRule::support ( const API api) const
inlinevirtual

Check whether a given API is available or not.

Reimplemented in loco::CanonicalShapeInferenceRule, and moco::TFShapeInferenceRule.

Definition at line 50 of file ShapeInferenceRule.h.

51 {
52 // To be backward compatible
53 return api == API::V1;
54 }

References V1.

Referenced by loco::ShapeInferenceSession::to().


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