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

#include <CircleOperationExporterRule.h>

Collaboration diagram for luci::OperationExporterRule:

Public Member Functions

 OperationExporterRule (ExportContext &ctx)
 
void visit (luci::CircleNode *node) final
 Default fallback.
 
void visit (luci::CircleConst *) final
 
void visit (luci::CircleInput *) final
 
void visit (luci::CircleOutput *) final
 
void visit (luci::CircleOutputDummy *) final
 
void visit (luci::CircleOutputExclude *) final
 
void visit (luci::CircleBidirectionalSequenceLSTMOut *) final
 
void visit (luci::CircleCustomOut *) final
 
void visit (luci::CircleIfOut *) final
 
void visit (luci::CircleNonMaxSuppressionV4Out *) final
 
void visit (luci::CircleNonMaxSuppressionV5Out *) final
 
void visit (luci::CircleSplitOut *) final
 
void visit (luci::CircleSplitVOut *) final
 
void visit (luci::CircleTopKV2Out *) final
 
void visit (luci::CircleUniqueOut *) final
 
void visit (luci::CircleUnpackOut *) final
 
void visit (luci::CircleVariable *) final
 
void visit (luci::CircleWhileOut *) final
 
- Public Member Functions inherited from luci::CircleNodeMutableVisitor< void >
virtual ~CircleNodeMutableVisitor ()=default
 
- Public Member Functions inherited from luci::CircleNodeMutableVisitorBase< T >
virtual ~CircleNodeMutableVisitorBase ()=default
 

Protected Attributes

ExportContext_ctx
 

Detailed Description

Definition at line 36 of file CircleOperationExporterRule.h.

Constructor & Destructor Documentation

◆ OperationExporterRule()

luci::OperationExporterRule::OperationExporterRule ( ExportContext ctx)
inline

Definition at line 39 of file CircleOperationExporterRule.h.

39 : _ctx{ctx}
40 {
41 // DO NOTHING
42 }

Member Function Documentation

◆ visit() [1/18]

void luci::OperationExporterRule::visit ( luci::CircleBidirectionalSequenceLSTMOut )
inlinefinal

Definition at line 57 of file CircleOperationExporterRule.h.

57{}

◆ visit() [2/18]

void luci::OperationExporterRule::visit ( luci::CircleConst )
inlinefinal

Definition at line 49 of file CircleOperationExporterRule.h.

49{/* skip, everything is done in exportOpDefinedTensors */};

◆ visit() [3/18]

void luci::OperationExporterRule::visit ( luci::CircleCustomOut )
inlinefinal

Definition at line 58 of file CircleOperationExporterRule.h.

58{}

◆ visit() [4/18]

void luci::OperationExporterRule::visit ( luci::CircleIfOut )
inlinefinal

Definition at line 59 of file CircleOperationExporterRule.h.

59{}

◆ visit() [5/18]

void luci::OperationExporterRule::visit ( luci::CircleInput )
inlinefinal

Definition at line 52 of file CircleOperationExporterRule.h.

52{}

◆ visit() [6/18]

void luci::OperationExporterRule::visit ( luci::CircleNode )
finalvirtual

Default fallback.

Reimplemented from luci::CircleNodeMutableVisitor< void >.

Definition at line 250 of file CircleOperationExporterRule.cpp.

251{
253 circle_custom_code(node), node->op_version());
254
255 std::vector<int32_t> inputs_vec;
256 for (uint32_t i = 0; i < node->arity(); ++i)
257 inputs_vec.push_back(luci::get_tensor_index(node->arg(i)));
258 auto inputs = _ctx.builder.CreateVector(inputs_vec);
259
260 OutputVectorExtractor outputs_vec_extractor;
261 auto outputs_vec = node->accept(&outputs_vec_extractor);
262 auto outputs = _ctx.builder.CreateVector(outputs_vec);
263
264 auto builtin_options = circle_builtin_options(node);
265
266 luci::BuiltinOptionsExtractor builtin_options_extractor(_ctx.builder);
267 auto options_offset = node->accept(&builtin_options_extractor);
268
269 // If node is not CircleCustom, null offset(0) is returned
270 auto custom_options = circle_custom_options(_ctx.builder, node);
271
272 auto op_offset = circle::CreateOperator(_ctx.builder, op_idx, inputs, outputs, builtin_options,
273 options_offset, custom_options);
274 _ctx.gd._operators.push_back(op_offset);
275}
Offset< Vector< T > > CreateVector(const T *v, size_t len)
Serialize an array into a FlatBuffer vector.
circle::BuiltinOptions circle_builtin_options(const luci::CircleNode *node)
flatbuffers::Offset< flatbuffers::Vector< uint8_t > > circle_custom_options(flatbuffers::FlatBufferBuilder &fb, const luci::CircleNode *node)
CircleTensorIndex get_tensor_index(loco::Node *node)
circle::BuiltinOperator circle_builtin_operator(const luci::CircleNode *node)
std::string circle_custom_code(const luci::CircleNode *node)
luci::SerializedGraphData & gd
flatbuffers::FlatBufferBuilder & builder
luci::SerializedModelData & md
std::vector< flatbuffers::Offset< circle::Operator > > _operators
uint32_t registerBuiltinOpcode(circle::BuiltinOperator builtin_code, const std::string &custom_code, const int32_t op_version)
if opcode is not registered in table of opcodes add it

References _ctx, luci::SerializedGraphData::_operators, luci::CircleNode::accept(), loco::Node::arg(), loco::Node::arity(), luci::ExportContext::builder, luci::circle_builtin_operator(), luci::circle_builtin_options(), luci::circle_custom_code(), luci::circle_custom_options(), flatbuffers::FlatBufferBuilder::CreateVector(), luci::ExportContext::gd, luci::get_tensor_index(), luci::ExportContext::md, luci::CircleNode::op_version(), and luci::SerializedModelData::registerBuiltinOpcode().

◆ visit() [7/18]

void luci::OperationExporterRule::visit ( luci::CircleNonMaxSuppressionV4Out )
inlinefinal

Definition at line 60 of file CircleOperationExporterRule.h.

60{}

◆ visit() [8/18]

void luci::OperationExporterRule::visit ( luci::CircleNonMaxSuppressionV5Out )
inlinefinal

Definition at line 61 of file CircleOperationExporterRule.h.

61{}

◆ visit() [9/18]

void luci::OperationExporterRule::visit ( luci::CircleOutput )
inlinefinal

Definition at line 53 of file CircleOperationExporterRule.h.

53{}

◆ visit() [10/18]

void luci::OperationExporterRule::visit ( luci::CircleOutputDummy )
inlinefinal

Definition at line 54 of file CircleOperationExporterRule.h.

54{}

◆ visit() [11/18]

void luci::OperationExporterRule::visit ( luci::CircleOutputExclude )
inlinefinal

Definition at line 55 of file CircleOperationExporterRule.h.

55{}

◆ visit() [12/18]

void luci::OperationExporterRule::visit ( luci::CircleSplitOut )
inlinefinal

Definition at line 62 of file CircleOperationExporterRule.h.

62{}

◆ visit() [13/18]

void luci::OperationExporterRule::visit ( luci::CircleSplitVOut )
inlinefinal

Definition at line 63 of file CircleOperationExporterRule.h.

63{}

◆ visit() [14/18]

void luci::OperationExporterRule::visit ( luci::CircleTopKV2Out )
inlinefinal

Definition at line 64 of file CircleOperationExporterRule.h.

64{}

◆ visit() [15/18]

void luci::OperationExporterRule::visit ( luci::CircleUniqueOut )
inlinefinal

Definition at line 65 of file CircleOperationExporterRule.h.

65{}

◆ visit() [16/18]

void luci::OperationExporterRule::visit ( luci::CircleUnpackOut )
inlinefinal

Definition at line 66 of file CircleOperationExporterRule.h.

66{}

◆ visit() [17/18]

void luci::OperationExporterRule::visit ( luci::CircleVariable )
inlinefinal

Definition at line 67 of file CircleOperationExporterRule.h.

67{}

◆ visit() [18/18]

void luci::OperationExporterRule::visit ( luci::CircleWhileOut )
inlinefinal

Definition at line 68 of file CircleOperationExporterRule.h.

68{}

Field Documentation

◆ _ctx

ExportContext& luci::OperationExporterRule::_ctx
protected

Definition at line 71 of file CircleOperationExporterRule.h.

Referenced by visit().


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