From fb74671a2e674520b6bd035f808a8b1ffef99619 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=84=B8=ED=9D=AC/On-Device=20Lab=28SR=29/Princip?= =?utf8?q?al=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Wed, 4 Sep 2019 12:59:55 +0900 Subject: [PATCH] [exo-tflite] Export TFLAdd (#7150) This will add export for TFLAdd node Signed-off-by: SaeHie Park --- compiler/exo-tflite/src/OperationExporter.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/compiler/exo-tflite/src/OperationExporter.cpp b/compiler/exo-tflite/src/OperationExporter.cpp index a569052..e3f1cc4 100644 --- a/compiler/exo-tflite/src/OperationExporter.cpp +++ b/compiler/exo-tflite/src/OperationExporter.cpp @@ -45,7 +45,7 @@ public: public: // FOR TFLNodes - // TODO TFLAdd + void visit(locoex::TFLAdd *) final; // TODO TFLAveragePool2D // TODO TFLConcatenation // TODO TFLConv2D @@ -96,7 +96,18 @@ private: SerializedModelData &gd; }; -// TODO TFLAdd +void OperationExporter::visit(locoex::TFLAdd *node) +{ + uint32_t op_idx = gd.registerBuiltinOpcode(tflite::BuiltinOperator_ADD); + std::vector inputs_vec{get_tensor_index(node->x()), get_tensor_index(node->y())}; + std::vector outputs_vec{get_tensor_index(static_cast(node))}; + auto inputs = builder.CreateVector(inputs_vec); + auto outputs = builder.CreateVector(outputs_vec); + auto options = CreateAddOptions(builder); // dummy option + auto op_offset = CreateOperator(builder, op_idx, inputs, outputs, + tflite::BuiltinOptions_AddOptions, options.Union()); + gd._operators.push_back(op_offset); +} // TODO TFLAveragePool2D -- 2.7.4