[exo-tflite] Export FixedReshape operation (#6565)
author박천교/On-Device Lab(SR)/Engineer/삼성전자 <ch.bahk@samsung.com>
Wed, 14 Aug 2019 01:53:42 +0000 (10:53 +0900)
committer박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Wed, 14 Aug 2019 01:53:42 +0000 (10:53 +0900)
This commit introduces export of FixedReshape operation

Signed-off-by: Cheongyo Bahk <ch.bahk@samsung.com>
compiler/exo-tflite/src/OperationExporter.cpp

index 7f9c07f..d799e46 100644 (file)
@@ -60,6 +60,7 @@ public:
   void visit(loco::EltwiseMul *) final;
   void visit(loco::EltwiseSub *) final;
   void visit(loco::EltwiseDiv *) final;
+  void visit(loco::FixedReshape *) final;
 
   void visit(locoex::COpCall *);
 
@@ -427,6 +428,18 @@ void OperationExporter::visit(loco::EltwiseDiv *node)
   gd._operators.push_back(op_offset);
 }
 
+void OperationExporter::visit(loco::FixedReshape *node)
+{
+  std::vector<int32_t> new_shape_vec;
+  for (uint32_t axis = 0; axis < node->rank(); ++axis)
+  {
+    assert(node->dim(axis).known());
+    new_shape_vec.push_back(node->dim(axis).value());
+  }
+
+  exportAsReshape(node, builder, new_shape_vec, gd);
+}
+
 inline flatbuffers::Offset<flatbuffers::Vector<uint8_t>>
 CreateCOpCallOptions(flatbuffers::FlatBufferBuilder &fbb, locoex::COpCall *copCall)
 {