ONE - On-device Neural Engine
Loading...
Searching...
No Matches
luci::GraphBuilderRegistry Class Referencefinal

Class to return graph builder for Circle nodes. More...

#include <GraphBuilderRegistry.h>

Collaboration diagram for luci::GraphBuilderRegistry:

Public Member Functions

 GraphBuilderRegistry ()
 
 GraphBuilderRegistry (const GraphBuilderSource *parent)
 
const GraphBuilderBaselookup (const circle::BuiltinOperator &op) const final
 Returns registered GraphBuilder pointer for operator or nullptr if not registered.
 
const NodeBuilderBaselookup (const NodeBuilderType type) const final
 Returns registered NodeBuilderBase pointer for type or nullptr if not registered.
 
void add (const circle::BuiltinOperator op, std::unique_ptr< GraphBuilderBase > &&builder)
 
void add (std::unique_ptr< NodeBuilderBase > &&builder)
 
- Public Member Functions inherited from luci::GraphBuilderSource
virtual ~GraphBuilderSource ()=default
 

Static Public Member Functions

static GraphBuilderRegistryget ()
 

Detailed Description

Class to return graph builder for Circle nodes.

Definition at line 46 of file GraphBuilderRegistry.h.

Constructor & Destructor Documentation

◆ GraphBuilderRegistry() [1/2]

luci::GraphBuilderRegistry::GraphBuilderRegistry ( )

Definition at line 26 of file GraphBuilderRegistry.cpp.

27{
28#define CIRCLE_NODE(OPCODE, CLASS) add(circle::BuiltinOperator_##OPCODE, std::make_unique<CLASS>());
29
30 CIRCLE_NODE(ABS, CircleAbsGraphBuilder); // 101
31 CIRCLE_NODE(ADD, CircleAddGraphBuilder); // 0
32 CIRCLE_NODE(ADD_N, CircleAddNGraphBuilder); // 106
33 CIRCLE_NODE(ARG_MAX, CircleArgMaxGraphBuilder); // 56
34 CIRCLE_NODE(ARG_MIN, CircleArgMinGraphBuilder); // 79
35 CIRCLE_NODE(AVERAGE_POOL_2D, CircleAveragePool2DGraphBuilder); // 1
36 CIRCLE_NODE(BATCH_MATMUL, CircleBatchMatMulGraphBuilder); // 126
37 CIRCLE_NODE(BATCH_TO_SPACE_ND, CircleBatchToSpaceNDGraphBuilder); // 37
38 CIRCLE_NODE(BCQ_FULLY_CONNECTED, CircleBCQFullyConnectedGraphBuilder); // 253
39 CIRCLE_NODE(BCQ_GATHER, CircleBCQGatherGraphBuilder); // 252
40 CIRCLE_NODE(BIDIRECTIONAL_SEQUENCE_LSTM, CircleBidirectionalSequenceLSTMGraphBuilder); // 52
41 CIRCLE_NODE(BROADCAST_TO, CircleBroadcastToGraphBuilder); // 130
42 CIRCLE_NODE(CAST, CircleCastGraphBuilder); // 53
43 CIRCLE_NODE(CEIL, CircleCeilGraphBuilder); // 104
44 CIRCLE_NODE(CUSTOM, CircleCustomGraphBuilder); // 32
45 CIRCLE_NODE(CONCATENATION, CircleConcatenationGraphBuilder); // 2
46 CIRCLE_NODE(CONV_2D, CircleConv2DGraphBuilder); // 3
47 CIRCLE_NODE(COS, CircleCosGraphBuilder); // 108
48 CIRCLE_NODE(CUMSUM, CircleCumSumGraphBuilder); // 128
49 CIRCLE_NODE(DENSIFY, CircleDensifyGraphBuilder); // 124
50 CIRCLE_NODE(DEPTH_TO_SPACE, CircleDepthToSpaceGraphBuilder); // 5
51 CIRCLE_NODE(DEPTHWISE_CONV_2D, CircleDepthwiseConv2DGraphBuilder); // 4
52 CIRCLE_NODE(DEQUANTIZE, CircleDequantizeGraphBuilder); // 6
53 CIRCLE_NODE(DIV, CircleDivGraphBuilder); // 42
54 CIRCLE_NODE(ELU, CircleEluGraphBuilder); // 111
55 CIRCLE_NODE(EQUAL, CircleEqualGraphBuilder); // 71
56 CIRCLE_NODE(EXP, CircleExpGraphBuilder); // 47
57 CIRCLE_NODE(EXPAND_DIMS, CircleExpandDimsGraphBuilder); // 70
58 CIRCLE_NODE(FAKE_QUANT, CircleFakeQuantGraphBuilder); // 80
59 CIRCLE_NODE(FILL, CircleFillGraphBuilder); // 94
60 CIRCLE_NODE(FLOOR, CircleFloorGraphBuilder); // 8
61 CIRCLE_NODE(FLOOR_DIV, CircleFloorDivGraphBuilder); // 90
62 CIRCLE_NODE(FLOOR_MOD, CircleFloorModGraphBuilder); // 95
63 CIRCLE_NODE(FULLY_CONNECTED, CircleFullyConnectedGraphBuilder); // 9
64 CIRCLE_NODE(GATHER, CircleGatherGraphBuilder); // 36
65 CIRCLE_NODE(GATHER_ND, CircleGatherNdGraphBuilder); // 107
66 CIRCLE_NODE(GELU, CircleGeluGraphBuilder); // 150
67 CIRCLE_NODE(GREATER, CircleGreaterGraphBuilder); // 61
68 CIRCLE_NODE(GREATER_EQUAL, CircleGreaterEqualGraphBuilder); // 62
69 CIRCLE_NODE(GRU, CircleGRUGraphBuilder); // 251
70 CIRCLE_NODE(HARD_SWISH, CircleHardSwishGraphBuilder); // 117
71 CIRCLE_NODE(IF, CircleIfGraphBuilder); // 118
72 CIRCLE_NODE(INSTANCE_NORM, CircleInstanceNormGraphBuilder); // 254
73 CIRCLE_NODE(L2_NORMALIZATION, CircleL2NormalizeGraphBuilder); // 11
74 CIRCLE_NODE(L2_POOL_2D, CircleL2Pool2DGraphBuilder); // 12
75 CIRCLE_NODE(LEAKY_RELU, CircleLeakyReluGraphBuilder); // 98
76 CIRCLE_NODE(LESS, CircleLessGraphBuilder); // 58
77 CIRCLE_NODE(LESS_EQUAL, CircleLessEqualGraphBuilder); // 63
78 CIRCLE_NODE(LOCAL_RESPONSE_NORMALIZATION, CircleLocalResponseNormalizationGraphBuilder); // 13
79 CIRCLE_NODE(LOG, CircleLogGraphBuilder); // 73
80 CIRCLE_NODE(LOGICAL_AND, CircleLogicalAndGraphBuilder); // 86
81 CIRCLE_NODE(LOGICAL_NOT, CircleLogicalNotGraphBuilder); // 87
82 CIRCLE_NODE(LOGICAL_OR, CircleLogicalOrGraphBuilder); // 84
83 CIRCLE_NODE(LOGISTIC, CircleLogisticGraphBuilder); // 14
84 CIRCLE_NODE(LOG_SOFTMAX, CircleLogSoftmaxGraphBuilder); // 50
85 CIRCLE_NODE(MATRIX_DIAG, CircleMatrixDiagGraphBuilder); // 113
86 CIRCLE_NODE(MATRIX_SET_DIAG, CircleMatrixSetDiagGraphBuilder); // 115
87 CIRCLE_NODE(MAXIMUM, CircleMaximumGraphBuilder); // 55
88 CIRCLE_NODE(MAX_POOL_2D, CircleMaxPool2DGraphBuilder); // 17
89 CIRCLE_NODE(MEAN, CircleMeanGraphBuilder); // 40
90 CIRCLE_NODE(MINIMUM, CircleMinimumGraphBuilder); // 57
91 CIRCLE_NODE(MIRROR_PAD, CircleMirrorPadGraphBuilder); // 100
92 CIRCLE_NODE(MUL, CircleMulGraphBuilder); // 18
93 CIRCLE_NODE(NEG, CircleNegGraphBuilder); // 59
94 CIRCLE_NODE(NON_MAX_SUPPRESSION_V4, CircleNonMaxSuppressionV4GraphBuilder); // 120
95 CIRCLE_NODE(NON_MAX_SUPPRESSION_V5, CircleNonMaxSuppressionV5GraphBuilder); // 121
96 CIRCLE_NODE(NOT_EQUAL, CircleNotEqualGraphBuilder); // 72
97 CIRCLE_NODE(ONE_HOT, CircleOneHotGraphBuilder); // 85
98 CIRCLE_NODE(PACK, CirclePackGraphBuilder); // 83
99 CIRCLE_NODE(PAD, CirclePadGraphBuilder); // 34
100 CIRCLE_NODE(PADV2, CirclePadV2GraphBuilder); // 60
101 CIRCLE_NODE(POW, CirclePowGraphBuilder); // 78
102 CIRCLE_NODE(PRELU, CirclePReluGraphBuilder); // 54
103 CIRCLE_NODE(QUANTIZE, CircleQuantizeGraphBuilder); // 114
104 CIRCLE_NODE(RANGE, CircleRangeGraphBuilder); // 96
105 CIRCLE_NODE(RANK, CircleRankGraphBuilder); // 110
106 CIRCLE_NODE(REDUCE_ANY, CircleReduceAnyGraphBuilder); // 91
107 CIRCLE_NODE(REDUCE_MAX, CircleReduceMaxGraphBuilder); // 82
108 CIRCLE_NODE(REDUCE_MIN, CircleReduceMinGraphBuilder); // 89
109 CIRCLE_NODE(REDUCE_PROD, CircleReduceProdGraphBuilder); // 81
110 CIRCLE_NODE(RELU, CircleReluGraphBuilder); // 19
111 CIRCLE_NODE(RELU_0_TO_1, CircleRelu0To1GraphBuilder); // 152
112 CIRCLE_NODE(RELU6, CircleRelu6GraphBuilder); // 21
113 CIRCLE_NODE(RELU_N1_TO_1, CircleReluN1To1GraphBuilder); // 20
114 CIRCLE_NODE(RESHAPE, CircleReshapeGraphBuilder); // 22
115 CIRCLE_NODE(RESIZE_BILINEAR, CircleResizeBilinearGraphBuilder); // 23
116 CIRCLE_NODE(RESIZE_NEAREST_NEIGHBOR, CircleResizeNearestNeighborGraphBuilder); // 97
117 CIRCLE_NODE(REVERSE_SEQUENCE, CircleReverseSequenceGraphBuilder); // 112
118 CIRCLE_NODE(REVERSE_V2, CircleReverseV2GraphBuilder); // 105
119 CIRCLE_NODE(RMS_NORM, CircleRmsNormGraphBuilder); // 250
120 CIRCLE_NODE(ROPE, CircleRoPEGraphBuilder); // 249
121 CIRCLE_NODE(ROUND, CircleRoundGraphBuilder); // 116
122 CIRCLE_NODE(RSQRT, CircleRsqrtGraphBuilder); // 76
123 CIRCLE_NODE(SCATTER_ND, CircleScatterNdGraphBuilder); // 122
124 CIRCLE_NODE(SEGMENT_SUM, CircleSegmentSumGraphBuilder); // 125
125 CIRCLE_NODE(SELECT, CircleSelectGraphBuilder); // 64
126 CIRCLE_NODE(SELECT_V2, CircleSelectV2GraphBuilder); // 123
127 CIRCLE_NODE(SHAPE, CircleShapeGraphBuilder); // 77
128 CIRCLE_NODE(SIN, CircleSinGraphBuilder); // 66
129 CIRCLE_NODE(SLICE, CircleSliceGraphBuilder); // 65
130 CIRCLE_NODE(SOFTMAX, CircleSoftmaxGraphBuilder); // 25
131 CIRCLE_NODE(SPACE_TO_BATCH_ND, CircleSpaceToBatchNDGraphBuilder); // 38
132 CIRCLE_NODE(SPACE_TO_DEPTH, CircleSpaceToDepthGraphBuilder); // 26
133 CIRCLE_NODE(SPARSE_TO_DENSE, CircleSparseToDenseGraphBuilder); // 68
134 CIRCLE_NODE(SPLIT, CircleSplitGraphBuilder); // 49
135 CIRCLE_NODE(SPLIT_V, CircleSplitVGraphBuilder); // 102
136 CIRCLE_NODE(SQRT, CircleSqrtGraphBuilder); // 75
137 CIRCLE_NODE(SQUARE, CircleSquareGraphBuilder); // 92
138 CIRCLE_NODE(SQUARED_DIFFERENCE, CircleSquaredDifferenceGraphBuilder); // 99
139 CIRCLE_NODE(SQUEEZE, CircleSqueezeGraphBuilder); // 43
140 CIRCLE_NODE(STRIDED_SLICE, CircleStridedSliceGraphBuilder); // 45
141 CIRCLE_NODE(SUB, CircleSubGraphBuilder); // 41
142 CIRCLE_NODE(SUM, CircleSumGraphBuilder); // 74
143 CIRCLE_NODE(SVDF, CircleSVDFBuilder); // 27
144 CIRCLE_NODE(TANH, CircleTanhGraphBuilder); // 28
145 CIRCLE_NODE(TILE, CircleTileGraphBuilder); // 69
146 CIRCLE_NODE(TOPK_V2, CircleTopKV2GraphBuilder); // 48
147 CIRCLE_NODE(TRANSPOSE, CircleTransposeGraphBuilder); // 39
148 CIRCLE_NODE(TRANSPOSE_CONV, CircleTransposeConvGraphBuilder); // 67
149 CIRCLE_NODE(UNIDIRECTIONAL_SEQUENCE_LSTM, CircleUnidirectionalSequenceLSTMGraphBuilder); // 44
150 CIRCLE_NODE(UNIQUE, CircleUniqueGraphBuilder); // 103
151 CIRCLE_NODE(UNPACK, CircleUnpackGraphBuilder); // 88
152 CIRCLE_NODE(WHERE, CircleWhereGraphBuilder); // 109
153 CIRCLE_NODE(WHILE, CircleWhileGraphBuilder); // 119
154 CIRCLE_NODE(ZEROS_LIKE, CircleZerosLikeGraphBuilder); // 93
155
156#undef CIRCLE_NODE
157
158 // BuiltinOperator_EMBEDDING_LOOKUP = 7,
159 // BuiltinOperator_HASHTABLE_LOOKUP = 10,
160 // BuiltinOperator_LSH_PROJECTION = 15,
161 // BuiltinOperator_LSTM = 16,
162 // BuiltinOperator_RNN = 24,
163 // BuiltinOperator_CONCAT_EMBEDDINGS = 29,
164 // BuiltinOperator_SKIP_GRAM = 30,
165 // BuiltinOperator_CALL = 31,
166 // BuiltinOperator_EMBEDDING_LOOKUP_SPARSE = 33,
167 // BuiltinOperator_UNIDIRECTIONAL_SEQUENCE_RNN = 35,
168 // BuiltinOperator_BIDIRECTIONAL_SEQUENCE_RNN = 46,
169 // BuiltinOperator_DELEGATE = 51,
170 // BuiltinOperator_ARG_MAX = 56,
171
172 // Register builders for nodes which not handles in builders registered above.
173#define CIRCLE_NODE(CLASS) add(std::make_unique<CLASS>())
174
175 CIRCLE_NODE(CircleConstNodeBuilder);
176
177#undef CIRCLE_NODE
178}
@ LOCAL_RESPONSE_NORMALIZATION
#define LOG(...)
Definition Logging.h:36
#define DEQUANTIZE(input, offset, scale, type, size)
#define QUANTIZE(input, offset, scale, type, size)
CIRCLE_NODE(OPCODE, CLASS)

References ADD, AVERAGE_POOL_2D, luci::CIRCLE_NODE, CONCATENATION, CONV_2D, DEPTH_TO_SPACE, DEPTHWISE_CONV_2D, DEQUANTIZE, DIV, FLOOR, FULLY_CONNECTED, L2_NORMALIZATION, L2_POOL_2D, LOCAL_RESPONSE_NORMALIZATION, LOG, LOGISTIC, MAX_POOL_2D, MUL, PAD, QUANTIZE, luci::RELU, luci::RELU6, luci::RELU_N1_TO_1, RESHAPE, RESIZE_BILINEAR, SOFTMAX, SPACE_TO_DEPTH, STRIDED_SLICE, SUB, SVDF, and luci::TANH.

◆ GraphBuilderRegistry() [2/2]

luci::GraphBuilderRegistry::GraphBuilderRegistry ( const GraphBuilderSource parent)
inline

Definition at line 52 of file GraphBuilderRegistry.h.

52 : _parent{parent}
53 {
54 // DO NOTHING
55 }

Member Function Documentation

◆ add() [1/2]

void luci::GraphBuilderRegistry::add ( const circle::BuiltinOperator  op,
std::unique_ptr< GraphBuilderBase > &&  builder 
)
inline

Definition at line 88 of file GraphBuilderRegistry.h.

89 {
90 _builder_map[op] = std::move(builder);
91 }

◆ add() [2/2]

void luci::GraphBuilderRegistry::add ( std::unique_ptr< NodeBuilderBase > &&  builder)
inline

Definition at line 93 of file GraphBuilderRegistry.h.

94 {
95 _node_builders[builder->builder_type()] = std::move(builder);
96 }

◆ get()

static GraphBuilderRegistry & luci::GraphBuilderRegistry::get ( )
inlinestatic

Definition at line 81 of file GraphBuilderRegistry.h.

82 {
83 static GraphBuilderRegistry me;
84 return me;
85 }

Referenced by entry().

◆ lookup() [1/2]

const GraphBuilderBase * luci::GraphBuilderRegistry::lookup ( const circle::BuiltinOperator &  op) const
inlinefinalvirtual

Returns registered GraphBuilder pointer for operator or nullptr if not registered.

Implements luci::GraphBuilderSource.

Definition at line 62 of file GraphBuilderRegistry.h.

63 {
64 if (_builder_map.find(op) == _builder_map.end())
65 return (_parent == nullptr) ? nullptr : _parent->lookup(op);
66
67 return _builder_map.at(op).get();
68 }
virtual const GraphBuilderBase * lookup(const circle::BuiltinOperator &op) const =0
Returns registered GraphBuilder pointer for operator (nullptr if not present)

References luci::GraphBuilderSource::lookup().

◆ lookup() [2/2]

const NodeBuilderBase * luci::GraphBuilderRegistry::lookup ( const NodeBuilderType  type) const
inlinefinalvirtual

Returns registered NodeBuilderBase pointer for type or nullptr if not registered.

Implements luci::GraphBuilderSource.

Definition at line 73 of file GraphBuilderRegistry.h.

74 {
75 if (_node_builders.find(type) == _node_builders.end())
76 return (_parent == nullptr) ? nullptr : _parent->lookup(type);
77
78 return _node_builders.at(type).get();
79 }

References luci::GraphBuilderSource::lookup().


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