summaryrefslogtreecommitdiff
path: root/compiler/tflchef/tflite
diff options
context:
space:
mode:
authorChunseok Lee <chunseok.lee@samsung.com>2020-12-14 14:43:04 +0900
committerChunseok Lee <chunseok.lee@samsung.com>2020-12-14 14:43:04 +0900
commit12d88feea8573f8490629cf62fc342b152e57d65 (patch)
tree3c734cc4d629834d2d523f4575ef84cd64684e57 /compiler/tflchef/tflite
parentd6b371e095d737922187a518b8faba1ef6f3a2b1 (diff)
downloadnnfw-12d88feea8573f8490629cf62fc342b152e57d65.tar.gz
nnfw-12d88feea8573f8490629cf62fc342b152e57d65.tar.bz2
nnfw-12d88feea8573f8490629cf62fc342b152e57d65.zip
Imported Upstream version 1.11.0upstream/1.11.0
Diffstat (limited to 'compiler/tflchef/tflite')
-rw-r--r--compiler/tflchef/tflite/CMakeLists.txt3
-rw-r--r--compiler/tflchef/tflite/include/tflchef/RecipeChef.h2
-rw-r--r--compiler/tflchef/tflite/src/Convert.cpp62
-rw-r--r--compiler/tflchef/tflite/src/Convert.h18
-rw-r--r--compiler/tflchef/tflite/src/FillerHelper.cpp50
-rw-r--r--compiler/tflchef/tflite/src/FillerHelper.h (renamed from compiler/tflchef/tflite/include/tflchef/RawModel.h)26
-rw-r--r--compiler/tflchef/tflite/src/Op/Abs.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/Abs.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Add.cpp54
-rw-r--r--compiler/tflchef/tflite/src/Op/Add.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/AddN.cpp46
-rw-r--r--compiler/tflchef/tflite/src/Op/AddN.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/ArgMax.cpp54
-rw-r--r--compiler/tflchef/tflite/src/Op/ArgMax.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/ArgMin.cpp54
-rw-r--r--compiler/tflchef/tflite/src/Op/ArgMin.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/BatchMatMul.cpp48
-rw-r--r--compiler/tflchef/tflite/src/Op/BatchMatMul.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/BatchToSpaceND.cpp53
-rw-r--r--compiler/tflchef/tflite/src/Op/BatchToSpaceND.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Cast.cpp48
-rw-r--r--compiler/tflchef/tflite/src/Op/Cast.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Ceil.cpp39
-rw-r--r--compiler/tflchef/tflite/src/Op/Ceil.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Conv2D.cpp3
-rw-r--r--compiler/tflchef/tflite/src/Op/Cos.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/Cos.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/DepthToSpace.cpp47
-rw-r--r--compiler/tflchef/tflite/src/Op/DepthToSpace.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/DepthwiseConv2D.cpp5
-rw-r--r--compiler/tflchef/tflite/src/Op/Dequantize.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/Dequantize.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/ELU.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/ELU.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Equal.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/Equal.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Exp.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/Exp.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/ExpandDims.cpp47
-rw-r--r--compiler/tflchef/tflite/src/Op/ExpandDims.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Fill.cpp47
-rw-r--r--compiler/tflchef/tflite/src/Op/Fill.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Floor.cpp39
-rw-r--r--compiler/tflchef/tflite/src/Op/Floor.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/FloorDiv.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/FloorDiv.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/FloorMod.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/FloorMod.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/FullyConnected.cpp10
-rw-r--r--compiler/tflchef/tflite/src/Op/Gather.cpp59
-rw-r--r--compiler/tflchef/tflite/src/Op/Gather.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/GatherNd.cpp50
-rw-r--r--compiler/tflchef/tflite/src/Op/GatherNd.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Greater.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/Greater.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/GreaterEqual.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/GreaterEqual.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/L2Normalize.cpp45
-rw-r--r--compiler/tflchef/tflite/src/Op/L2Normalize.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/L2Pool2D.cpp52
-rw-r--r--compiler/tflchef/tflite/src/Op/L2Pool2D.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/LeakyRelu.cpp46
-rw-r--r--compiler/tflchef/tflite/src/Op/LeakyRelu.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Less.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/Less.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/LessEqual.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/LessEqual.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/LocalResponseNormalization.cpp51
-rw-r--r--compiler/tflchef/tflite/src/Op/LocalResponseNormalization.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Log.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/Log.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/LogSoftmax.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/LogSoftmax.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/LogicalAnd.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/LogicalAnd.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/LogicalNot.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/LogicalNot.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/LogicalOr.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/LogicalOr.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Logistic.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/Logistic.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/MatrixDiag.cpp38
-rw-r--r--compiler/tflchef/tflite/src/Op/MatrixDiag.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/MatrixSetDiag.cpp38
-rw-r--r--compiler/tflchef/tflite/src/Op/MatrixSetDiag.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Maximum.cpp38
-rw-r--r--compiler/tflchef/tflite/src/Op/Maximum.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Mean.cpp54
-rw-r--r--compiler/tflchef/tflite/src/Op/Mean.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Minimum.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/Minimum.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/MirrorPad.cpp53
-rw-r--r--compiler/tflchef/tflite/src/Op/MirrorPad.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Mul.cpp53
-rw-r--r--compiler/tflchef/tflite/src/Op/Mul.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Neg.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/Neg.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/NonMaxSuppressionV4.cpp56
-rw-r--r--compiler/tflchef/tflite/src/Op/NonMaxSuppressionV4.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/NonMaxSuppressionV5.cpp59
-rw-r--r--compiler/tflchef/tflite/src/Op/NonMaxSuppressionV5.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/NotEqual.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/NotEqual.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/OneHot.cpp87
-rw-r--r--compiler/tflchef/tflite/src/Op/OneHot.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/PRelu.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/PRelu.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Pack.cpp48
-rw-r--r--compiler/tflchef/tflite/src/Op/Pack.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Pad.cpp47
-rw-r--r--compiler/tflchef/tflite/src/Op/Pad.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/PadV2.cpp42
-rw-r--r--compiler/tflchef/tflite/src/Op/PadV2.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Pow.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/Pow.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Range.cpp61
-rw-r--r--compiler/tflchef/tflite/src/Op/Range.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Rank.cpp38
-rw-r--r--compiler/tflchef/tflite/src/Op/Rank.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/ReLUN1To1.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/ReLUN1To1.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/ReduceAny.cpp52
-rw-r--r--compiler/tflchef/tflite/src/Op/ReduceAny.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/ReduceMax.cpp54
-rw-r--r--compiler/tflchef/tflite/src/Op/ReduceMax.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/ReduceMin.cpp54
-rw-r--r--compiler/tflchef/tflite/src/Op/ReduceMin.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/ReduceProd.cpp52
-rw-r--r--compiler/tflchef/tflite/src/Op/ReduceProd.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Reshape.cpp25
-rw-r--r--compiler/tflchef/tflite/src/Op/ResizeBilinear.cpp59
-rw-r--r--compiler/tflchef/tflite/src/Op/ResizeBilinear.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/ResizeNearestNeighbor.cpp59
-rw-r--r--compiler/tflchef/tflite/src/Op/ResizeNearestNeighbor.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/ReverseSequence.cpp53
-rw-r--r--compiler/tflchef/tflite/src/Op/ReverseSequence.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/ReverseV2.cpp44
-rw-r--r--compiler/tflchef/tflite/src/Op/ReverseV2.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Round.cpp37
-rw-r--r--compiler/tflchef/tflite/src/Op/Round.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Rsqrt.cpp39
-rw-r--r--compiler/tflchef/tflite/src/Op/Rsqrt.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/ScatterNd.cpp43
-rw-r--r--compiler/tflchef/tflite/src/Op/ScatterNd.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/SegmentSum.cpp41
-rw-r--r--compiler/tflchef/tflite/src/Op/SegmentSum.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Select.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/Select.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/SelectV2.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/SelectV2.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Shape.cpp45
-rw-r--r--compiler/tflchef/tflite/src/Op/Shape.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Sin.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/Sin.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Slice.cpp50
-rw-r--r--compiler/tflchef/tflite/src/Op/Slice.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Softmax.cpp47
-rw-r--r--compiler/tflchef/tflite/src/Op/Softmax.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/SpaceToBatchND.cpp53
-rw-r--r--compiler/tflchef/tflite/src/Op/SpaceToBatchND.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/SpaceToDepth.cpp47
-rw-r--r--compiler/tflchef/tflite/src/Op/SpaceToDepth.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/SparseToDense.cpp54
-rw-r--r--compiler/tflchef/tflite/src/Op/SparseToDense.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Split.cpp54
-rw-r--r--compiler/tflchef/tflite/src/Op/Split.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/SplitV.cpp56
-rw-r--r--compiler/tflchef/tflite/src/Op/SplitV.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Sqrt.cpp13
-rw-r--r--compiler/tflchef/tflite/src/Op/Square.cpp40
-rw-r--r--compiler/tflchef/tflite/src/Op/Square.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/SquaredDifference.cpp41
-rw-r--r--compiler/tflchef/tflite/src/Op/SquaredDifference.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Squeeze.cpp52
-rw-r--r--compiler/tflchef/tflite/src/Op/Squeeze.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/StridedSlice.cpp60
-rw-r--r--compiler/tflchef/tflite/src/Op/StridedSlice.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Sub.cpp9
-rw-r--r--compiler/tflchef/tflite/src/Op/Sum.cpp54
-rw-r--r--compiler/tflchef/tflite/src/Op/Sum.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Tanh.cpp39
-rw-r--r--compiler/tflchef/tflite/src/Op/Tanh.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Tile.cpp48
-rw-r--r--compiler/tflchef/tflite/src/Op/Tile.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/TopKV2.cpp50
-rw-r--r--compiler/tflchef/tflite/src/Op/TopKV2.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Transpose.cpp48
-rw-r--r--compiler/tflchef/tflite/src/Op/Transpose.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/TransposeConv.cpp64
-rw-r--r--compiler/tflchef/tflite/src/Op/TransposeConv.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/UnidirectionalSequenceLSTM.cpp66
-rw-r--r--compiler/tflchef/tflite/src/Op/UnidirectionalSequenceLSTM.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Unique.cpp47
-rw-r--r--compiler/tflchef/tflite/src/Op/Unique.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Unpack.cpp45
-rw-r--r--compiler/tflchef/tflite/src/Op/Unpack.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/Where.cpp36
-rw-r--r--compiler/tflchef/tflite/src/Op/Where.h39
-rw-r--r--compiler/tflchef/tflite/src/Op/ZerosLike.cpp42
-rw-r--r--compiler/tflchef/tflite/src/Op/ZerosLike.h39
-rw-r--r--compiler/tflchef/tflite/src/RawModelLoader.cpp94
-rw-r--r--compiler/tflchef/tflite/src/RecipeChef.cpp132
-rw-r--r--compiler/tflchef/tflite/src/TFliteImport.h66
-rw-r--r--compiler/tflchef/tflite/src/TFliteOpChef.h2
-rw-r--r--compiler/tflchef/tflite/src/TFliteOpChefs.h94
-rw-r--r--compiler/tflchef/tflite/src/TFliteOpRegistry.h128
206 files changed, 8584 insertions, 220 deletions
diff --git a/compiler/tflchef/tflite/CMakeLists.txt b/compiler/tflchef/tflite/CMakeLists.txt
index 477c70c4c..83127cb3e 100644
--- a/compiler/tflchef/tflite/CMakeLists.txt
+++ b/compiler/tflchef/tflite/CMakeLists.txt
@@ -4,6 +4,7 @@ add_library(tflchef_tflite STATIC ${SOURCES})
target_include_directories(tflchef_tflite PUBLIC include)
target_include_directories(tflchef_tflite PRIVATE src)
target_link_libraries(tflchef_tflite tflchef_proto)
-target_link_libraries(tflchef_tflite tflchef_flatbuffer)
+target_link_libraries(tflchef_tflite mio_tflite)
target_link_libraries(tflchef_tflite stdex)
target_link_libraries(tflchef_tflite cwrap)
+target_link_libraries(tflchef_tflite souschef)
diff --git a/compiler/tflchef/tflite/include/tflchef/RecipeChef.h b/compiler/tflchef/tflite/include/tflchef/RecipeChef.h
index 98f9f1f82..2d292c3d5 100644
--- a/compiler/tflchef/tflite/include/tflchef/RecipeChef.h
+++ b/compiler/tflchef/tflite/include/tflchef/RecipeChef.h
@@ -17,7 +17,7 @@
#ifndef __RECIPE_CHEF_H__
#define __RECIPE_CHEF_H__
-#include <tflite_generated.h>
+#include <mio/tflite/schema_generated.h>
#include <tflchef.pb.h>
#include <memory>
diff --git a/compiler/tflchef/tflite/src/Convert.cpp b/compiler/tflchef/tflite/src/Convert.cpp
index b7a93cb57..29276ff94 100644
--- a/compiler/tflchef/tflite/src/Convert.cpp
+++ b/compiler/tflchef/tflite/src/Convert.cpp
@@ -27,12 +27,15 @@ tflchef::TensorType as_tflchef_type(const tflite::TensorType type)
return tflchef::FLOAT32;
case tflite::TensorType_INT32:
return tflchef::INT32;
+ case tflite::TensorType_INT64:
+ return tflchef::INT64;
+ case tflite::TensorType_UINT8:
+ return tflchef::UINT8;
+ case tflite::TensorType_BOOL:
+ return tflchef::BOOL;
// TODO handle other types
// TensorType_FLOAT16
- // TensorType_UINT8
- // TensorType_INT64
// TensorType_STRING
- // TensorType_BOOL
// TensorType_INT16
// TensorType_COMPLEX64
default:
@@ -48,12 +51,14 @@ tflchef::Activation as_tflchef_activation(const tflite::ActivationFunctionType t
return tflchef::NONE;
case tflite::ActivationFunctionType_RELU:
return tflchef::RELU;
+ case tflite::ActivationFunctionType_RELU_N1_TO_1:
+ return tflchef::RELU_N1_TO_1;
case tflite::ActivationFunctionType_RELU6:
return tflchef::RELU6;
- // TODO handle other types
- // ActivationFunctionType_RELU_N1_TO_1
- // ActivationFunctionType_TANH
- // ActivationFunctionType_SIGN_BIT
+ case tflite::ActivationFunctionType_TANH:
+ return tflchef::TANH;
+ case tflite::ActivationFunctionType_SIGN_BIT:
+ return tflchef::SIGN_BIT;
default:
throw std::runtime_error{"unsupported activation type"};
}
@@ -72,4 +77,47 @@ tflchef::Padding as_tflchef_padding(const tflite::Padding padding)
}
}
+tflchef::MirrorPadMode as_tflchef_mirrorpadmode(const tflite::MirrorPadMode mode)
+{
+ switch (mode)
+ {
+ case tflite::MirrorPadMode_REFLECT:
+ return tflchef::REFLECT;
+ case tflite::MirrorPadMode_SYMMETRIC:
+ return tflchef::SYMMETRIC;
+ default:
+ throw std::runtime_error{"Unknown mirrorpad mode"};
+ }
+}
+
+tflchef::DimensionType as_tflchef_sparse_dim_type(const tflite::DimensionType type)
+{
+ switch (type)
+ {
+ case tflite::DimensionType_DENSE:
+ return tflchef::DimensionType::DENSE;
+ case tflite::DimensionType_SPARSE_CSR:
+ return tflchef::DimensionType::SPARSE_CSR;
+ default:
+ throw std::runtime_error("unsupported sparse dimension type");
+ }
+}
+
+tflchef::SparseIndexVecType as_tflchef_sparse_idx_vec_type(const tflite::SparseIndexVector type)
+{
+ switch (type)
+ {
+ case tflite::SparseIndexVector_NONE:
+ return tflchef::SparseIndexVecType::SparseIdxVecType_NONE;
+ case tflite::SparseIndexVector_Int32Vector:
+ return tflchef::SparseIndexVecType::INT32VEC;
+ case tflite::SparseIndexVector_Uint16Vector:
+ return tflchef::SparseIndexVecType::UINT16VEC;
+ case tflite::SparseIndexVector_Uint8Vector:
+ return tflchef::SparseIndexVecType::UINT8VEC;
+ default:
+ throw std::runtime_error("unsupported sparse index vector type");
+ }
+}
+
} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Convert.h b/compiler/tflchef/tflite/src/Convert.h
index 4973da111..cf0c61550 100644
--- a/compiler/tflchef/tflite/src/Convert.h
+++ b/compiler/tflchef/tflite/src/Convert.h
@@ -17,7 +17,7 @@
#ifndef __CONVERT_H__
#define __CONVERT_H__
-#include <tflite_generated.h>
+#include <mio/tflite/schema_generated.h>
#include <tflchef.pb.h>
@@ -27,6 +27,22 @@ namespace tflchef
tflchef::TensorType as_tflchef_type(const tflite::TensorType type);
tflchef::Activation as_tflchef_activation(const tflite::ActivationFunctionType type);
tflchef::Padding as_tflchef_padding(const tflite::Padding padding);
+tflchef::MirrorPadMode as_tflchef_mirrorpadmode(const tflite::MirrorPadMode mode);
+tflchef::DimensionType as_tflchef_sparse_dim_type(const tflite::DimensionType type);
+tflchef::SparseIndexVecType as_tflchef_sparse_idx_vec_type(const tflite::SparseIndexVector type);
+
+/**
+ * @brief extract buffer data to std::vector<DT>
+ */
+template <typename DT> std::vector<DT> extract_buffer(const tflite::Buffer *buffer)
+{
+ assert(buffer->data() != nullptr);
+ auto buffer_length = buffer->data()->size();
+ auto num_elements = buffer_length / sizeof(DT);
+ std::vector<DT> result(num_elements);
+ std::memcpy(result.data(), buffer->data()->data(), buffer_length);
+ return result;
+}
template <typename T> std::vector<T> as_index_vector(const flatbuffers::Vector<T> *flat_array)
{
diff --git a/compiler/tflchef/tflite/src/FillerHelper.cpp b/compiler/tflchef/tflite/src/FillerHelper.cpp
new file mode 100644
index 000000000..cf96d2e8c
--- /dev/null
+++ b/compiler/tflchef/tflite/src/FillerHelper.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "FillerHelper.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void fill_tensor_to_import(int32_t idx, TFliteImport *import)
+{
+ const tflite::Tensor *tensor = import->tensors()->Get(idx);
+ if (tensor != nullptr)
+ {
+ if (tensor->type() == tflite::TensorType::TensorType_INT32)
+ {
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ if (buffer && buffer->data())
+ {
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(idx, vec);
+ }
+ }
+ else if (tensor->type() == tflite::TensorType::TensorType_FLOAT32)
+ {
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ if (buffer && buffer->data())
+ {
+ auto vec = extract_buffer<float>(buffer);
+ import->set_tensor_filler(idx, vec);
+ }
+ }
+ }
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/include/tflchef/RawModel.h b/compiler/tflchef/tflite/src/FillerHelper.h
index 6979f65fd..053a5c18a 100644
--- a/compiler/tflchef/tflite/include/tflchef/RawModel.h
+++ b/compiler/tflchef/tflite/src/FillerHelper.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,28 +14,18 @@
* limitations under the License.
*/
-#ifndef __RAW_MODEL_H__
-#define __RAW_MODEL_H__
+#ifndef __FILLER_HELPER_H__
+#define __FILLER_HELPER_H__
-#include "tflite_generated.h"
+#include "TFliteImport.h"
-namespace tflchef
-{
+#include <mio/tflite/schema_generated.h>
-struct RawModel
+namespace tflchef
{
- virtual ~RawModel() = default;
- virtual const ::tflite::Model *model(void) const = 0;
-};
-
-/**
- * @brief Load TensorFlow Lite model (as a RawModel) from a given path
- *
- * @note May return a nullptr
- */
-std::unique_ptr<RawModel> load_tflite(const std::string &path);
+void fill_tensor_to_import(int32_t idx, TFliteImport *import);
} // namespace tflchef
-#endif // __RAW_MODEL_H__
+#endif // __FILLER_HELPER_H__
diff --git a/compiler/tflchef/tflite/src/Op/Abs.cpp b/compiler/tflchef/tflite/src/Op/Abs.cpp
new file mode 100644
index 000000000..7d769e344
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Abs.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Abs.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpAbs::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpAbs::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Abs");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Abs.h b/compiler/tflchef/tflite/src/Op/Abs.h
new file mode 100644
index 000000000..d99b0d593
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Abs.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_ABS_H__
+#define __TFLITE_OP_ABS_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for abs
+ */
+class TFliteOpAbs : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_ABS_H__
diff --git a/compiler/tflchef/tflite/src/Op/Add.cpp b/compiler/tflchef/tflite/src/Op/Add.cpp
new file mode 100644
index 000000000..3e880a63b
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Add.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Add.h"
+
+#include "Convert.h"
+#include "FillerHelper.h"
+
+namespace tflchef
+{
+
+void TFliteOpAdd::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Add may have constant input
+
+ const std::vector<int32_t> &inputs = as_index_vector(op->inputs());
+ assert(inputs.size() == 2);
+
+ fill_tensor_to_import(inputs[0], import);
+ fill_tensor_to_import(inputs[1], import);
+}
+
+tflchef::Operation *TFliteOpAdd::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_AddOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Add");
+
+ auto op_options = operation->mutable_add_options();
+
+ op_options->set_activation(as_tflchef_activation(op_params->fused_activation_function()));
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Add.h b/compiler/tflchef/tflite/src/Op/Add.h
new file mode 100644
index 000000000..49d945f8b
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Add.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_ADD_H__
+#define __TFLITE_OP_ADD_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for add
+ */
+class TFliteOpAdd : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_ADD_H__
diff --git a/compiler/tflchef/tflite/src/Op/AddN.cpp b/compiler/tflchef/tflite/src/Op/AddN.cpp
new file mode 100644
index 000000000..aeb3803ab
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/AddN.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "AddN.h"
+
+#include "Convert.h"
+#include "FillerHelper.h"
+
+namespace tflchef
+{
+
+void TFliteOpAddN::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // AddN may have constant input
+
+ const std::vector<int32_t> &inputs = as_index_vector(op->inputs());
+
+ for (uint32_t idx = 0; idx < inputs.size(); ++idx)
+ fill_tensor_to_import(inputs[idx], import);
+}
+
+tflchef::Operation *TFliteOpAddN::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("AddN");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/AddN.h b/compiler/tflchef/tflite/src/Op/AddN.h
new file mode 100644
index 000000000..4387aa06a
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/AddN.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_ADD_N_H__
+#define __TFLITE_OP_ADD_N_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for AddN
+ */
+class TFliteOpAddN : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_ADD_N_H__
diff --git a/compiler/tflchef/tflite/src/Op/ArgMax.cpp b/compiler/tflchef/tflite/src/Op/ArgMax.cpp
new file mode 100644
index 000000000..f4d1c5e66
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ArgMax.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ArgMax.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpArgMax::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // filler for second input, argmax/dim
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *dim_tensor = import->tensors()->Get(inputs[1]);
+ assert(dim_tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(dim_tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+}
+
+tflchef::Operation *TFliteOpArgMax::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_ArgMaxOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("ArgMax");
+
+ auto op_options = operation->mutable_argmax_options();
+
+ op_options->set_output_type(as_tflchef_type(op_params->output_type()));
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/ArgMax.h b/compiler/tflchef/tflite/src/Op/ArgMax.h
new file mode 100644
index 000000000..30068ecf2
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ArgMax.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_ARGMAX_H__
+#define __TFLITE_OP_ARGMAX_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for ArgMax
+ */
+class TFliteOpArgMax : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_ARGMAX_H__
diff --git a/compiler/tflchef/tflite/src/Op/ArgMin.cpp b/compiler/tflchef/tflite/src/Op/ArgMin.cpp
new file mode 100644
index 000000000..faab0b830
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ArgMin.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ArgMin.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpArgMin::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // filler for second input, argmin/dim
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *dim_tensor = import->tensors()->Get(inputs[1]);
+ assert(dim_tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(dim_tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+}
+
+tflchef::Operation *TFliteOpArgMin::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_ArgMinOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("ArgMin");
+
+ auto op_options = operation->mutable_argmin_options();
+
+ op_options->set_output_type(as_tflchef_type(op_params->output_type()));
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/ArgMin.h b/compiler/tflchef/tflite/src/Op/ArgMin.h
new file mode 100644
index 000000000..83c643c1a
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ArgMin.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_ARGMIN_H__
+#define __TFLITE_OP_ARGMIN_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for ArgMin
+ */
+class TFliteOpArgMin : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_ARGMIN_H__
diff --git a/compiler/tflchef/tflite/src/Op/BatchMatMul.cpp b/compiler/tflchef/tflite/src/Op/BatchMatMul.cpp
new file mode 100644
index 000000000..598e58c94
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/BatchMatMul.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "BatchMatMul.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpBatchMatMul::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpBatchMatMul::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("BatchMatMul");
+
+ auto op_options = operation->mutable_batch_matmul_options();
+
+ auto op_params = op->builtin_options_as_BatchMatMulOptions();
+ assert(op_params != nullptr);
+
+ op_options->set_adj_x(op_params->adj_x());
+ op_options->set_adj_y(op_params->adj_y());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/BatchMatMul.h b/compiler/tflchef/tflite/src/Op/BatchMatMul.h
new file mode 100644
index 000000000..6eb4c6e68
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/BatchMatMul.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_BATCHMATMUL_H__
+#define __TFLITE_OP_BATCHMATMUL_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for BATCH_MATMUL
+ */
+class TFliteOpBatchMatMul : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_BATCHMATMUL_H__
diff --git a/compiler/tflchef/tflite/src/Op/BatchToSpaceND.cpp b/compiler/tflchef/tflite/src/Op/BatchToSpaceND.cpp
new file mode 100644
index 000000000..d5d9606d1
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/BatchToSpaceND.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "BatchToSpaceND.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpBatchToSpaceND::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // filler for second, third input
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[1]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+
+ tensor = import->tensors()->Get(inputs[2]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ buffer = import->buffers()->Get(tensor->buffer());
+ vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[2], vec);
+}
+
+tflchef::Operation *TFliteOpBatchToSpaceND::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("BatchToSpaceND");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/BatchToSpaceND.h b/compiler/tflchef/tflite/src/Op/BatchToSpaceND.h
new file mode 100644
index 000000000..ae2114c97
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/BatchToSpaceND.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_BATCHTOSPACEND_H__
+#define __TFLITE_OP_BATCHTOSPACEND_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for BatchToSpaceND
+ */
+class TFliteOpBatchToSpaceND : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_BATCHTOSPACEND_H__
diff --git a/compiler/tflchef/tflite/src/Op/Cast.cpp b/compiler/tflchef/tflite/src/Op/Cast.cpp
new file mode 100644
index 000000000..393bb4b35
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Cast.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Cast.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpCast::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpCast::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_CastOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Cast");
+
+ auto op_options = operation->mutable_cast_options();
+
+ op_options->set_in_data_type(as_tflchef_type(op_params->in_data_type()));
+ op_options->set_out_data_type(as_tflchef_type(op_params->out_data_type()));
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Cast.h b/compiler/tflchef/tflite/src/Op/Cast.h
new file mode 100644
index 000000000..29c126c93
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Cast.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_CAST_H__
+#define __TFLITE_OP_CAST_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for CAST
+ */
+class TFliteOpCast : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_CAST_H__
diff --git a/compiler/tflchef/tflite/src/Op/Ceil.cpp b/compiler/tflchef/tflite/src/Op/Ceil.cpp
new file mode 100644
index 000000000..d3ef3adae
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Ceil.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Ceil.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpCeil::filler(const tflite::Operator *, TFliteImport *, tflchef::ModelRecipe *) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpCeil::build(const tflite::Operator *, TFliteImport *,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Ceil");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Ceil.h b/compiler/tflchef/tflite/src/Op/Ceil.h
new file mode 100644
index 000000000..44df20778
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Ceil.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_CEIL_H__
+#define __TFLITE_OP_CEIL_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for CEIL
+ */
+class TFliteOpCeil : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_CEIL_H__
diff --git a/compiler/tflchef/tflite/src/Op/Conv2D.cpp b/compiler/tflchef/tflite/src/Op/Conv2D.cpp
index 5d48ee24f..57abd4649 100644
--- a/compiler/tflchef/tflite/src/Op/Conv2D.cpp
+++ b/compiler/tflchef/tflite/src/Op/Conv2D.cpp
@@ -50,7 +50,8 @@ tflchef::Operation *TFliteOpConv2D::build(const tflite::Operator *op, TFliteImpo
op_options->set_stride_h(op_params->stride_h());
op_options->set_stride_w(op_params->stride_w());
op_options->set_padding(as_tflchef_padding(op_params->padding()));
- // TODO support dilation
+ op_options->set_dilation_w_factor(op_params->dilation_w_factor());
+ op_options->set_dilation_h_factor(op_params->dilation_h_factor());
return operation;
}
diff --git a/compiler/tflchef/tflite/src/Op/Cos.cpp b/compiler/tflchef/tflite/src/Op/Cos.cpp
new file mode 100644
index 000000000..9f2c49d49
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Cos.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Cos.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpCos::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpCos::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Cos");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Cos.h b/compiler/tflchef/tflite/src/Op/Cos.h
new file mode 100644
index 000000000..8f3dbe3a6
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Cos.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_COS_H__
+#define __TFLITE_OP_COS_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Cos
+ */
+class TFliteOpCos : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_COS_H__
diff --git a/compiler/tflchef/tflite/src/Op/DepthToSpace.cpp b/compiler/tflchef/tflite/src/Op/DepthToSpace.cpp
new file mode 100644
index 000000000..1a0917e8e
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/DepthToSpace.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "DepthToSpace.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpDepthToSpace::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpDepthToSpace::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("DepthToSpace");
+
+ auto op_params = op->builtin_options_as_DepthToSpaceOptions();
+ assert(op_params != nullptr);
+
+ auto op_options = operation->mutable_depth_to_space_options();
+
+ op_options->set_block_size(op_params->block_size());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/DepthToSpace.h b/compiler/tflchef/tflite/src/Op/DepthToSpace.h
new file mode 100644
index 000000000..b5852ac89
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/DepthToSpace.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_DEPTHTOSPACE_H__
+#define __TFLITE_OP_DEPTHTOSPACE_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for DepthToSpace
+ */
+class TFliteOpDepthToSpace : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_DEPTHTOSPACE_H__
diff --git a/compiler/tflchef/tflite/src/Op/DepthwiseConv2D.cpp b/compiler/tflchef/tflite/src/Op/DepthwiseConv2D.cpp
index b19f9330f..5fed3353a 100644
--- a/compiler/tflchef/tflite/src/Op/DepthwiseConv2D.cpp
+++ b/compiler/tflchef/tflite/src/Op/DepthwiseConv2D.cpp
@@ -50,9 +50,8 @@ tflchef::Operation *TFliteOpDepthwiseConv2D::build(const tflite::Operator *op, T
op_options->set_stride_h(op_params->stride_h());
op_options->set_stride_w(op_params->stride_w());
op_options->set_depth_multiplier(op_params->depth_multiplier());
- // TODO support dilation
- // op_params->dilation_w_factor()
- // op_params->dilation_h_factor()
+ op_options->set_dilation_w_factor(op_params->dilation_w_factor());
+ op_options->set_dilation_h_factor(op_params->dilation_h_factor());
op_options->set_padding(as_tflchef_padding(op_params->padding()));
return operation;
diff --git a/compiler/tflchef/tflite/src/Op/Dequantize.cpp b/compiler/tflchef/tflite/src/Op/Dequantize.cpp
new file mode 100644
index 000000000..436a0db19
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Dequantize.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Dequantize.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpDequantize::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpDequantize::build(const tflite::Operator *, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Dequantize");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Dequantize.h b/compiler/tflchef/tflite/src/Op/Dequantize.h
new file mode 100644
index 000000000..df1c7bbdb
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Dequantize.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_DEQUANTIZE_H__
+#define __TFLITE_OP_DEQUANTIZE_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Dequantize
+ */
+class TFliteOpDequantize : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_DEQUANTIZE_H__
diff --git a/compiler/tflchef/tflite/src/Op/ELU.cpp b/compiler/tflchef/tflite/src/Op/ELU.cpp
new file mode 100644
index 000000000..cb4b61d66
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ELU.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ELU.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpELU::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpELU::build(const tflite::Operator *, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("ELU");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/ELU.h b/compiler/tflchef/tflite/src/Op/ELU.h
new file mode 100644
index 000000000..490c9fde4
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ELU.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_ELU_H__
+#define __TFLITE_OP_ELU_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for ELU
+ */
+class TFliteOpELU : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_ELU_H__
diff --git a/compiler/tflchef/tflite/src/Op/Equal.cpp b/compiler/tflchef/tflite/src/Op/Equal.cpp
new file mode 100644
index 000000000..a51586228
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Equal.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Equal.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpEqual::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpEqual::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Equal");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Equal.h b/compiler/tflchef/tflite/src/Op/Equal.h
new file mode 100644
index 000000000..fd4b40001
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Equal.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_EQUAL_H__
+#define __TFLITE_OP_EQUAL_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Equal
+ */
+class TFliteOpEqual : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_EQUAL_H__
diff --git a/compiler/tflchef/tflite/src/Op/Exp.cpp b/compiler/tflchef/tflite/src/Op/Exp.cpp
new file mode 100644
index 000000000..f715da6ef
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Exp.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Exp.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpExp::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpExp::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Exp");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Exp.h b/compiler/tflchef/tflite/src/Op/Exp.h
new file mode 100644
index 000000000..5ff3ddc8b
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Exp.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_EXP_H__
+#define __TFLITE_OP_EXP_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Exp
+ */
+class TFliteOpExp : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_EXP_H__
diff --git a/compiler/tflchef/tflite/src/Op/ExpandDims.cpp b/compiler/tflchef/tflite/src/Op/ExpandDims.cpp
new file mode 100644
index 000000000..e30e8dbcc
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ExpandDims.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ExpandDims.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpExpandDims::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Fill for axis input
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[1]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+}
+
+tflchef::Operation *TFliteOpExpandDims::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("ExpandDims");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/ExpandDims.h b/compiler/tflchef/tflite/src/Op/ExpandDims.h
new file mode 100644
index 000000000..e2f3e4e50
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ExpandDims.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_EXPAND_DIMS_H__
+#define __TFLITE_OP_EXPAND_DIMS_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for ExpandDims
+ */
+class TFliteOpExpandDims : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_EXPAND_DIMS_H__
diff --git a/compiler/tflchef/tflite/src/Op/Fill.cpp b/compiler/tflchef/tflite/src/Op/Fill.cpp
new file mode 100644
index 000000000..08b695fd7
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Fill.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Fill.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpFill::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *dims_tensor = import->tensors()->Get(inputs[0]);
+ assert(dims_tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(dims_tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[0], vec);
+}
+
+tflchef::Operation *TFliteOpFill::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+ operation->set_type("Fill");
+
+ // FillOptions are empty
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Fill.h b/compiler/tflchef/tflite/src/Op/Fill.h
new file mode 100644
index 000000000..4f46f628a
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Fill.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_FILL_H__
+#define __TFLITE_OP_FILL_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Fill
+ */
+class TFliteOpFill : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_FILL_H__
diff --git a/compiler/tflchef/tflite/src/Op/Floor.cpp b/compiler/tflchef/tflite/src/Op/Floor.cpp
new file mode 100644
index 000000000..373c69f71
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Floor.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Floor.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpFloor::filler(const tflite::Operator *, TFliteImport *, tflchef::ModelRecipe *) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpFloor::build(const tflite::Operator *, TFliteImport *,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Floor");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Floor.h b/compiler/tflchef/tflite/src/Op/Floor.h
new file mode 100644
index 000000000..f0f8ef38a
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Floor.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_FLOOR_H__
+#define __TFLITE_OP_FLOOR_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for FLOOR
+ */
+class TFliteOpFloor : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_FLOOR_H__
diff --git a/compiler/tflchef/tflite/src/Op/FloorDiv.cpp b/compiler/tflchef/tflite/src/Op/FloorDiv.cpp
new file mode 100644
index 000000000..492c6941f
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/FloorDiv.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "FloorDiv.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpFloorDiv::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpFloorDiv::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("FloorDiv");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/FloorDiv.h b/compiler/tflchef/tflite/src/Op/FloorDiv.h
new file mode 100644
index 000000000..5d049a668
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/FloorDiv.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_FLOORDIV_H__
+#define __TFLITE_OP_FLOORDIV_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for floor division
+ */
+class TFliteOpFloorDiv : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_FLOORDIV_H__
diff --git a/compiler/tflchef/tflite/src/Op/FloorMod.cpp b/compiler/tflchef/tflite/src/Op/FloorMod.cpp
new file mode 100644
index 000000000..997d82664
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/FloorMod.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "FloorMod.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpFloorMod::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpFloorMod::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("FloorMod");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/FloorMod.h b/compiler/tflchef/tflite/src/Op/FloorMod.h
new file mode 100644
index 000000000..f36dfe813
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/FloorMod.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_FLOOR_MOD_H__
+#define __TFLITE_OP_FLOOR_MOD_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for FLOOR_MOD
+ */
+class TFliteOpFloorMod : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_FLOOR_MOD_H__
diff --git a/compiler/tflchef/tflite/src/Op/FullyConnected.cpp b/compiler/tflchef/tflite/src/Op/FullyConnected.cpp
index 4291c844b..1f6e73aa6 100644
--- a/compiler/tflchef/tflite/src/Op/FullyConnected.cpp
+++ b/compiler/tflchef/tflite/src/Op/FullyConnected.cpp
@@ -17,6 +17,7 @@
#include "FullyConnected.h"
#include "Convert.h"
+#include "FillerHelper.h"
namespace tflchef
{
@@ -24,7 +25,14 @@ namespace tflchef
void TFliteOpFullyConnected::filler(const tflite::Operator *op, TFliteImport *import,
tflchef::ModelRecipe *model_recipe) const
{
- // Nothing to do with filler
+ const auto &inputs = *op->inputs();
+
+ for (uint32_t idx = 1; idx < inputs.size(); idx++)
+ {
+ // optional input tensor idx has minus value.
+ if (inputs[idx] >= 0)
+ fill_tensor_to_import(inputs[idx], import);
+ }
}
tflchef::Operation *TFliteOpFullyConnected::build(const tflite::Operator *op, TFliteImport *import,
diff --git a/compiler/tflchef/tflite/src/Op/Gather.cpp b/compiler/tflchef/tflite/src/Op/Gather.cpp
new file mode 100644
index 000000000..98da3ec43
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Gather.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Gather.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpGather::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+ // But second input has filler for constant inputs
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[1]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+
+ if (buffer && buffer->data())
+ {
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+ }
+}
+
+tflchef::Operation *TFliteOpGather::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_GatherOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Gather");
+
+ auto op_options = operation->mutable_gather_options();
+
+ op_options->set_axis(op_params->axis());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Gather.h b/compiler/tflchef/tflite/src/Op/Gather.h
new file mode 100644
index 000000000..e01276b76
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Gather.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_GATHER_H__
+#define __TFLITE_OP_GATHER_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Gather
+ */
+class TFliteOpGather : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_GATHER_H__
diff --git a/compiler/tflchef/tflite/src/Op/GatherNd.cpp b/compiler/tflchef/tflite/src/Op/GatherNd.cpp
new file mode 100644
index 000000000..0ff5a0b7f
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/GatherNd.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "GatherNd.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpGatherNd::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // indices buffer has filler
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[1]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+
+ if (buffer && buffer->data())
+ {
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+ }
+}
+
+tflchef::Operation *TFliteOpGatherNd::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+ operation->set_type("GatherNd");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/GatherNd.h b/compiler/tflchef/tflite/src/Op/GatherNd.h
new file mode 100644
index 000000000..112f23d33
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/GatherNd.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_GATHER_ND_H__
+#define __TFLITE_OP_GATHER_ND_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for GatherNd
+ */
+class TFliteOpGatherNd : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_GATHER_ND_H__
diff --git a/compiler/tflchef/tflite/src/Op/Greater.cpp b/compiler/tflchef/tflite/src/Op/Greater.cpp
new file mode 100644
index 000000000..4e41efb2d
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Greater.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Greater.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpGreater::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpGreater::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Greater");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Greater.h b/compiler/tflchef/tflite/src/Op/Greater.h
new file mode 100644
index 000000000..3ab2d1a4e
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Greater.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_GREATER_H__
+#define __TFLITE_OP_GREATER_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Greater
+ */
+class TFliteOpGreater : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_GREATER_H__
diff --git a/compiler/tflchef/tflite/src/Op/GreaterEqual.cpp b/compiler/tflchef/tflite/src/Op/GreaterEqual.cpp
new file mode 100644
index 000000000..aead30e57
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/GreaterEqual.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "GreaterEqual.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpGreaterEqual::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpGreaterEqual::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("GreaterEqual");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/GreaterEqual.h b/compiler/tflchef/tflite/src/Op/GreaterEqual.h
new file mode 100644
index 000000000..96b0af78a
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/GreaterEqual.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_GREATEREQUAL_H__
+#define __TFLITE_OP_GREATEREQUAL_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Greater Equal
+ */
+class TFliteOpGreaterEqual : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_GREATEREQUAL_H__
diff --git a/compiler/tflchef/tflite/src/Op/L2Normalize.cpp b/compiler/tflchef/tflite/src/Op/L2Normalize.cpp
new file mode 100644
index 000000000..0a8908472
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/L2Normalize.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "L2Normalize.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpL2Normalize::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpL2Normalize::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_L2NormOptions();
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("L2Normalize");
+
+ auto op_options = operation->mutable_l2norm_options();
+
+ op_options->set_activation(as_tflchef_activation(op_params->fused_activation_function()));
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/L2Normalize.h b/compiler/tflchef/tflite/src/Op/L2Normalize.h
new file mode 100644
index 000000000..a73eae6c8
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/L2Normalize.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_L2NORMALIZE_H__
+#define __TFLITE_OP_L2NORMALIZE_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for L2Normalize
+ */
+class TFliteOpL2Normalize : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_L2NORMALIZE_H__
diff --git a/compiler/tflchef/tflite/src/Op/L2Pool2D.cpp b/compiler/tflchef/tflite/src/Op/L2Pool2D.cpp
new file mode 100644
index 000000000..8db4b02b6
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/L2Pool2D.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "L2Pool2D.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpL2Pool2D::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpL2Pool2D::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_Pool2DOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("L2Pool2D");
+
+ auto op_options = operation->mutable_l2pool2d_options();
+
+ op_options->set_padding(as_tflchef_padding(op_params->padding()));
+ op_options->set_stride_h(op_params->stride_h());
+ op_options->set_stride_w(op_params->stride_w());
+ op_options->set_filter_height(op_params->filter_height());
+ op_options->set_filter_width(op_params->filter_width());
+ op_options->set_activation(as_tflchef_activation(op_params->fused_activation_function()));
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/L2Pool2D.h b/compiler/tflchef/tflite/src/Op/L2Pool2D.h
new file mode 100644
index 000000000..046353440
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/L2Pool2D.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_L2_POOL2D_H__
+#define __TFLITE_OP_L2_POOL2D_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for L2_POOL_2D
+ */
+class TFliteOpL2Pool2D : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_L2_POOL2D_H__
diff --git a/compiler/tflchef/tflite/src/Op/LeakyRelu.cpp b/compiler/tflchef/tflite/src/Op/LeakyRelu.cpp
new file mode 100644
index 000000000..bf9cb2fb3
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/LeakyRelu.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "LeakyRelu.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpLeakyRelu::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpLeakyRelu::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_LeakyReluOptions();
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("LeakyRelu");
+
+ auto *op_options = operation->mutable_leaky_relu_options();
+
+ op_options->set_alpha(op_params->alpha());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/LeakyRelu.h b/compiler/tflchef/tflite/src/Op/LeakyRelu.h
new file mode 100644
index 000000000..28e63e0ca
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/LeakyRelu.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_LEAKY_RELU_H__
+#define __TFLITE_OP_LEAKY_RELU_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for LeakyReLU
+ */
+class TFliteOpLeakyRelu : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_LEAKY_RELU_H__
diff --git a/compiler/tflchef/tflite/src/Op/Less.cpp b/compiler/tflchef/tflite/src/Op/Less.cpp
new file mode 100644
index 000000000..0360317c7
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Less.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Less.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpLess::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpLess::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Less");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Less.h b/compiler/tflchef/tflite/src/Op/Less.h
new file mode 100644
index 000000000..1316cb613
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Less.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_LESS_H__
+#define __TFLITE_OP_LESS_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Less
+ */
+class TFliteOpLess : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_LESS_H__
diff --git a/compiler/tflchef/tflite/src/Op/LessEqual.cpp b/compiler/tflchef/tflite/src/Op/LessEqual.cpp
new file mode 100644
index 000000000..b8c42e80d
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/LessEqual.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "LessEqual.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpLessEqual::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpLessEqual::build(const tflite::Operator *, TFliteImport *,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("LessEqual");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/LessEqual.h b/compiler/tflchef/tflite/src/Op/LessEqual.h
new file mode 100644
index 000000000..81c710fbc
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/LessEqual.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_LESSEQUAL_H__
+#define __TFLITE_OP_LESSEQUAL_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for LessEqual
+ */
+class TFliteOpLessEqual : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_LESSEQUAL_H__
diff --git a/compiler/tflchef/tflite/src/Op/LocalResponseNormalization.cpp b/compiler/tflchef/tflite/src/Op/LocalResponseNormalization.cpp
new file mode 100644
index 000000000..8bebd9e90
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/LocalResponseNormalization.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "LocalResponseNormalization.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpLocalResponseNormalization::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *
+TFliteOpLocalResponseNormalization::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_LocalResponseNormalizationOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("LocalResponseNormalization");
+
+ auto op_options = operation->mutable_local_response_normalization_options();
+
+ op_options->set_radius(op_params->radius());
+ op_options->set_bias(op_params->bias());
+ op_options->set_alpha(op_params->alpha());
+ op_options->set_beta(op_params->beta());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/LocalResponseNormalization.h b/compiler/tflchef/tflite/src/Op/LocalResponseNormalization.h
new file mode 100644
index 000000000..c0eb3f2b1
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/LocalResponseNormalization.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_LOCAL_RESPONSE_NORMALIZATION_H__
+#define __TFLITE_OP_LOCAL_RESPONSE_NORMALIZATION_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for LocalResponseNormalization
+ */
+class TFliteOpLocalResponseNormalization : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_LOCAL_RESPONSE_NORMALIZATION_H__
diff --git a/compiler/tflchef/tflite/src/Op/Log.cpp b/compiler/tflchef/tflite/src/Op/Log.cpp
new file mode 100644
index 000000000..a68dc9a31
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Log.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Log.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpLog::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpLog::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Log");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Log.h b/compiler/tflchef/tflite/src/Op/Log.h
new file mode 100644
index 000000000..9d17e2f81
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Log.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_LOG_H__
+#define __TFLITE_OP_LOG_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Log
+ */
+class TFliteOpLog : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_LOG_H__
diff --git a/compiler/tflchef/tflite/src/Op/LogSoftmax.cpp b/compiler/tflchef/tflite/src/Op/LogSoftmax.cpp
new file mode 100644
index 000000000..8f0e1a9f9
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/LogSoftmax.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "LogSoftmax.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpLogSoftmax::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpLogSoftmax::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("LogSoftmax");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/LogSoftmax.h b/compiler/tflchef/tflite/src/Op/LogSoftmax.h
new file mode 100644
index 000000000..efd81f3e9
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/LogSoftmax.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_LOG_SOFTMAX_H__
+#define __TFLITE_OP_LOG_SOFTMAX_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for LogSoftmax
+ */
+class TFliteOpLogSoftmax : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_LOG_SOFTMAX_H__
diff --git a/compiler/tflchef/tflite/src/Op/LogicalAnd.cpp b/compiler/tflchef/tflite/src/Op/LogicalAnd.cpp
new file mode 100644
index 000000000..2cc486426
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/LogicalAnd.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "LogicalAnd.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpLogicalAnd::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpLogicalAnd::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("LogicalAnd");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/LogicalAnd.h b/compiler/tflchef/tflite/src/Op/LogicalAnd.h
new file mode 100644
index 000000000..1f7a964b9
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/LogicalAnd.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_LOGICALAND_H__
+#define __TFLITE_OP_LOGICALAND_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for LogicalAnd
+ */
+class TFliteOpLogicalAnd : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_LOGICALAND_H__
diff --git a/compiler/tflchef/tflite/src/Op/LogicalNot.cpp b/compiler/tflchef/tflite/src/Op/LogicalNot.cpp
new file mode 100644
index 000000000..ecd5b903c
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/LogicalNot.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "LogicalNot.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpLogicalNot::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpLogicalNot::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("LogicalNot");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/LogicalNot.h b/compiler/tflchef/tflite/src/Op/LogicalNot.h
new file mode 100644
index 000000000..b75d33554
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/LogicalNot.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_LOGICALNOT_H__
+#define __TFLITE_OP_LOGICALNOT_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for LogicalNot
+ */
+class TFliteOpLogicalNot : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_LOGICALNOT_H__
diff --git a/compiler/tflchef/tflite/src/Op/LogicalOr.cpp b/compiler/tflchef/tflite/src/Op/LogicalOr.cpp
new file mode 100644
index 000000000..b91f4cfca
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/LogicalOr.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "LogicalOr.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpLogicalOr::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpLogicalOr::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("LogicalOr");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/LogicalOr.h b/compiler/tflchef/tflite/src/Op/LogicalOr.h
new file mode 100644
index 000000000..5331a0d65
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/LogicalOr.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_LOGICALOR_H__
+#define __TFLITE_OP_LOGICALOR_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for LogicalOr
+ */
+class TFliteOpLogicalOr : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_LOGICALOR_H__
diff --git a/compiler/tflchef/tflite/src/Op/Logistic.cpp b/compiler/tflchef/tflite/src/Op/Logistic.cpp
new file mode 100644
index 000000000..18b3b5c00
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Logistic.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Logistic.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpLogistic::filler(const tflite::Operator *, TFliteImport *,
+ tflchef::ModelRecipe *) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpLogistic::build(const tflite::Operator *, TFliteImport *,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Logistic");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Logistic.h b/compiler/tflchef/tflite/src/Op/Logistic.h
new file mode 100644
index 000000000..a75bf490e
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Logistic.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_LOGISTIC_H__
+#define __TFLITE_OP_LOGISTIC_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for LOGISTIC
+ */
+class TFliteOpLogistic : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_LOGISTIC_H__
diff --git a/compiler/tflchef/tflite/src/Op/MatrixDiag.cpp b/compiler/tflchef/tflite/src/Op/MatrixDiag.cpp
new file mode 100644
index 000000000..ca84c4949
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/MatrixDiag.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "MatrixDiag.h"
+
+namespace tflchef
+{
+
+void TFliteOpMatrixDiag::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpMatrixDiag::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("MatrixDiag");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/MatrixDiag.h b/compiler/tflchef/tflite/src/Op/MatrixDiag.h
new file mode 100644
index 000000000..4074f2c36
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/MatrixDiag.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_MATRIX_DIAG_H__
+#define __TFLITE_OP_MATRIX_DIAG_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for MatrixDiag
+ */
+class TFliteOpMatrixDiag : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_MATRIX_DIAG_H__
diff --git a/compiler/tflchef/tflite/src/Op/MatrixSetDiag.cpp b/compiler/tflchef/tflite/src/Op/MatrixSetDiag.cpp
new file mode 100644
index 000000000..97c7de41f
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/MatrixSetDiag.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "MatrixSetDiag.h"
+
+namespace tflchef
+{
+
+void TFliteOpMatrixSetDiag::filler(const tflite::Operator *, TFliteImport *,
+ tflchef::ModelRecipe *) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpMatrixSetDiag::build(const tflite::Operator *, TFliteImport *,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("MatrixSetDiag");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/MatrixSetDiag.h b/compiler/tflchef/tflite/src/Op/MatrixSetDiag.h
new file mode 100644
index 000000000..0e7ec7f32
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/MatrixSetDiag.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_MATRIX_SET_DIAG_H__
+#define __TFLITE_OP_MATRIX_SET_DIAG_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for MatrixSetDiag
+ */
+class TFliteOpMatrixSetDiag : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_MATRIX_SET_DIAG_H__
diff --git a/compiler/tflchef/tflite/src/Op/Maximum.cpp b/compiler/tflchef/tflite/src/Op/Maximum.cpp
new file mode 100644
index 000000000..fb977b6ed
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Maximum.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Maximum.h"
+
+namespace tflchef
+{
+
+void TFliteOpMaximum::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpMaximum::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Maximum");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Maximum.h b/compiler/tflchef/tflite/src/Op/Maximum.h
new file mode 100644
index 000000000..acafec343
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Maximum.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_MAXIMUM_H__
+#define __TFLITE_OP_MAXIMUM_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for maximum
+ */
+class TFliteOpMaximum : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_MAXIMUM_H__
diff --git a/compiler/tflchef/tflite/src/Op/Mean.cpp b/compiler/tflchef/tflite/src/Op/Mean.cpp
new file mode 100644
index 000000000..1c2975781
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Mean.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Mean.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpMean::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // filler for second input
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[1]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+}
+
+tflchef::Operation *TFliteOpMean::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_ReducerOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Mean");
+
+ auto op_options = operation->mutable_mean_options();
+
+ op_options->set_keep_dims(op_params->keep_dims());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Mean.h b/compiler/tflchef/tflite/src/Op/Mean.h
new file mode 100644
index 000000000..532c40c66
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Mean.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_MEAN_H__
+#define __TFLITE_OP_MEAN_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for mean
+ */
+class TFliteOpMean : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_MEAN_H__
diff --git a/compiler/tflchef/tflite/src/Op/Minimum.cpp b/compiler/tflchef/tflite/src/Op/Minimum.cpp
new file mode 100644
index 000000000..2bb50cb89
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Minimum.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Minimum.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpMinimum::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpMinimum::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Minimum");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Minimum.h b/compiler/tflchef/tflite/src/Op/Minimum.h
new file mode 100644
index 000000000..5db5b7940
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Minimum.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_MINIMUM_H__
+#define __TFLITE_OP_MINIMUM_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for minimum
+ */
+class TFliteOpMinimum : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_MINIMUM_H__
diff --git a/compiler/tflchef/tflite/src/Op/MirrorPad.cpp b/compiler/tflchef/tflite/src/Op/MirrorPad.cpp
new file mode 100644
index 000000000..c688552ee
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/MirrorPad.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "MirrorPad.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpMirrorPad::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // filler for second input
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[1]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+}
+
+tflchef::Operation *TFliteOpMirrorPad::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+ operation->set_type("MirrorPad");
+
+ auto op_options = operation->mutable_mirrorpad_options();
+
+ auto op_params = op->builtin_options_as_MirrorPadOptions();
+ assert(op_params != nullptr);
+
+ op_options->set_mode(as_tflchef_mirrorpadmode(op_params->mode()));
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/MirrorPad.h b/compiler/tflchef/tflite/src/Op/MirrorPad.h
new file mode 100644
index 000000000..c9acdd498
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/MirrorPad.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_MIRROR_PAD_H__
+#define __TFLITE_OP_MIRROR_PAD_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for MIRROR_PAD
+ */
+class TFliteOpMirrorPad : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_MIRROR_PAD_H__
diff --git a/compiler/tflchef/tflite/src/Op/Mul.cpp b/compiler/tflchef/tflite/src/Op/Mul.cpp
new file mode 100644
index 000000000..9faa4acaf
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Mul.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Mul.h"
+
+#include "Convert.h"
+#include "FillerHelper.h"
+
+namespace tflchef
+{
+
+void TFliteOpMul::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Mul may have constant input
+
+ const std::vector<int32_t> &inputs = as_index_vector(op->inputs());
+ assert(inputs.size() == 2);
+
+ fill_tensor_to_import(inputs[0], import);
+ fill_tensor_to_import(inputs[1], import);
+}
+
+tflchef::Operation *TFliteOpMul::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Mul");
+
+ auto op_params = op->builtin_options_as_MulOptions();
+ assert(op_params != nullptr);
+
+ auto op_options = operation->mutable_mul_options();
+ op_options->set_activation(as_tflchef_activation(op_params->fused_activation_function()));
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Mul.h b/compiler/tflchef/tflite/src/Op/Mul.h
new file mode 100644
index 000000000..fd009d2fd
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Mul.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_MUL_H__
+#define __TFLITE_OP_MUL_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for MUL
+ */
+class TFliteOpMul : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_MUL_H__
diff --git a/compiler/tflchef/tflite/src/Op/Neg.cpp b/compiler/tflchef/tflite/src/Op/Neg.cpp
new file mode 100644
index 000000000..c691390a3
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Neg.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Neg.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpNeg::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpNeg::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Neg");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Neg.h b/compiler/tflchef/tflite/src/Op/Neg.h
new file mode 100644
index 000000000..c77ab7e84
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Neg.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_NEG_H__
+#define __TFLITE_OP_NEG_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for abs
+ */
+class TFliteOpNeg : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_NEG_H__
diff --git a/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV4.cpp b/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV4.cpp
new file mode 100644
index 000000000..ad9921970
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV4.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "NonMaxSuppressionV4.h"
+
+#include "Convert.h"
+#include "FillerHelper.h"
+
+namespace tflchef
+{
+
+void TFliteOpNonMaxSuppressionV4::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *max_output_size_tensor = import->tensors()->Get(inputs[2]);
+ assert(max_output_size_tensor->type() == tflite::TensorType::TensorType_INT32);
+
+ const tflite::Tensor *iou_threshold_tensor = import->tensors()->Get(inputs[3]);
+ assert(iou_threshold_tensor->type() == tflite::TensorType::TensorType_FLOAT32);
+
+ const tflite::Tensor *score_threshold_tensor = import->tensors()->Get(inputs[4]);
+ assert(score_threshold_tensor->type() == tflite::TensorType::TensorType_FLOAT32);
+
+ for (int32_t index = 2; index < 5; ++index)
+ {
+ fill_tensor_to_import(index, import);
+ }
+}
+
+tflchef::Operation *TFliteOpNonMaxSuppressionV4::build(const tflite::Operator *op,
+ TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("NonMaxSuppressionV4");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV4.h b/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV4.h
new file mode 100644
index 000000000..114a2ad2f
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV4.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_NON_MAX_SUPPRESSION_V4_H__
+#define __TFLITE_OP_NON_MAX_SUPPRESSION_V4_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for NON_MAX_SUPPRESSION_V4
+ */
+class TFliteOpNonMaxSuppressionV4 : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_NON_MAX_SUPPRESSION_V4_H__
diff --git a/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV5.cpp b/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV5.cpp
new file mode 100644
index 000000000..db7f4c932
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV5.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "NonMaxSuppressionV5.h"
+
+#include "Convert.h"
+#include "FillerHelper.h"
+
+namespace tflchef
+{
+
+void TFliteOpNonMaxSuppressionV5::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *max_output_size_tensor = import->tensors()->Get(inputs[2]);
+ assert(max_output_size_tensor->type() == tflite::TensorType::TensorType_INT32);
+
+ const tflite::Tensor *iou_threshold_tensor = import->tensors()->Get(inputs[3]);
+ assert(iou_threshold_tensor->type() == tflite::TensorType::TensorType_FLOAT32);
+
+ const tflite::Tensor *score_threshold_tensor = import->tensors()->Get(inputs[4]);
+ assert(score_threshold_tensor->type() == tflite::TensorType::TensorType_FLOAT32);
+
+ const tflite::Tensor *soft_nms_sigma_tensor = import->tensors()->Get(inputs[5]);
+ assert(soft_nms_sigma_tensor->type() == tflite::TensorType::TensorType_FLOAT32);
+
+ for (int32_t index = 2; index < 6; ++index)
+ {
+ fill_tensor_to_import(index, import);
+ }
+}
+
+tflchef::Operation *TFliteOpNonMaxSuppressionV5::build(const tflite::Operator *op,
+ TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("NonMaxSuppressionV5");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV5.h b/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV5.h
new file mode 100644
index 000000000..c948043f4
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV5.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_NON_MAX_SUPPRESSION_V5_H__
+#define __TFLITE_OP_NON_MAX_SUPPRESSION_V5_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for NON_MAX_SUPPRESSION_V5
+ */
+class TFliteOpNonMaxSuppressionV5 : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_NON_MAX_SUPPRESSION_V5_H__
diff --git a/compiler/tflchef/tflite/src/Op/NotEqual.cpp b/compiler/tflchef/tflite/src/Op/NotEqual.cpp
new file mode 100644
index 000000000..c2275db06
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/NotEqual.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "NotEqual.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpNotEqual::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpNotEqual::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("NotEqual");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/NotEqual.h b/compiler/tflchef/tflite/src/Op/NotEqual.h
new file mode 100644
index 000000000..b1febdcc5
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/NotEqual.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_NOTEQUAL_H__
+#define __TFLITE_OP_NOTEQUAL_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Not Equal
+ */
+class TFliteOpNotEqual : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_NOTEQUAL_H__
diff --git a/compiler/tflchef/tflite/src/Op/OneHot.cpp b/compiler/tflchef/tflite/src/Op/OneHot.cpp
new file mode 100644
index 000000000..f26ed3e7f
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/OneHot.cpp
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "OneHot.h"
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpOneHot::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // only depth(second input) has constant on recipe cause depth value is used in shape inference.
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[1]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+
+ if (buffer && buffer->data())
+ {
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+ }
+
+ // on/off can be dtype of input/output. let's support INT32/FLOAT32 for now
+ for (int32_t index = 2; index <= 3; ++index)
+ {
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[index]);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ if (buffer && buffer->data())
+ {
+ switch (tensor->type())
+ {
+ case tflite::TensorType::TensorType_INT32:
+ {
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[index], vec);
+ break;
+ }
+
+ case tflite::TensorType::TensorType_FLOAT32:
+ {
+ auto vec = extract_buffer<float>(buffer);
+ import->set_tensor_filler(inputs[index], vec);
+ break;
+ }
+
+ default:
+ assert(false);
+ break;
+ }
+ }
+ }
+}
+
+tflchef::Operation *TFliteOpOneHot::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_OneHotOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("OneHot");
+
+ auto op_options = operation->mutable_onehot_options();
+
+ op_options->set_axis(op_params->axis());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/OneHot.h b/compiler/tflchef/tflite/src/Op/OneHot.h
new file mode 100644
index 000000000..50bbed095
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/OneHot.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_ONEHOT_H__
+#define __TFLITE_OP_ONEHOT_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for OneHot
+ */
+class TFliteOpOneHot : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_ONEHOT_H__
diff --git a/compiler/tflchef/tflite/src/Op/PRelu.cpp b/compiler/tflchef/tflite/src/Op/PRelu.cpp
new file mode 100644
index 000000000..8a5e83a84
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/PRelu.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "PRelu.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpPRelu::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+}
+
+tflchef::Operation *TFliteOpPRelu::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+ operation->set_type("PRelu");
+
+ // PReluOptions are empty
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/PRelu.h b/compiler/tflchef/tflite/src/Op/PRelu.h
new file mode 100644
index 000000000..b35c6e7ce
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/PRelu.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_PRELU_H__
+#define __TFLITE_OP_PRELU_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for PRelu
+ */
+class TFliteOpPRelu : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_PRELU_H__
diff --git a/compiler/tflchef/tflite/src/Op/Pack.cpp b/compiler/tflchef/tflite/src/Op/Pack.cpp
new file mode 100644
index 000000000..ddf8c7d5d
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Pack.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Pack.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpPack::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpPack::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_PackOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Pack");
+
+ auto op_options = operation->mutable_pack_options();
+
+ op_options->set_axis(op_params->axis());
+ op_options->set_values_count(op_params->values_count());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Pack.h b/compiler/tflchef/tflite/src/Op/Pack.h
new file mode 100644
index 000000000..7779f64ed
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Pack.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_PACK_H__
+#define __TFLITE_OP_PACK_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for pack
+ */
+class TFliteOpPack : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_PACK_H__
diff --git a/compiler/tflchef/tflite/src/Op/Pad.cpp b/compiler/tflchef/tflite/src/Op/Pad.cpp
new file mode 100644
index 000000000..2978e4422
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Pad.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Pad.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpPad::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // filler for second input
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[1]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+}
+
+tflchef::Operation *TFliteOpPad::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Pad");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Pad.h b/compiler/tflchef/tflite/src/Op/Pad.h
new file mode 100644
index 000000000..99998d418
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Pad.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_PAD_H__
+#define __TFLITE_OP_PAD_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for PAD
+ */
+class TFliteOpPad : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_PAD_H__
diff --git a/compiler/tflchef/tflite/src/Op/PadV2.cpp b/compiler/tflchef/tflite/src/Op/PadV2.cpp
new file mode 100644
index 000000000..0b1c9f3b2
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/PadV2.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "PadV2.h"
+
+#include "FillerHelper.h"
+
+namespace tflchef
+{
+
+void TFliteOpPadV2::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Filler for paddings and constant_values
+ fill_tensor_to_import(1, import);
+ fill_tensor_to_import(2, import);
+}
+
+tflchef::Operation *TFliteOpPadV2::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("PadV2");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/PadV2.h b/compiler/tflchef/tflite/src/Op/PadV2.h
new file mode 100644
index 000000000..3aa474b92
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/PadV2.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_PADV2_H__
+#define __TFLITE_OP_PADV2_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for PADV2
+ */
+class TFliteOpPadV2 : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_PADV2_H__
diff --git a/compiler/tflchef/tflite/src/Op/Pow.cpp b/compiler/tflchef/tflite/src/Op/Pow.cpp
new file mode 100644
index 000000000..fe8e8ac0f
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Pow.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Pow.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpPow::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+}
+
+tflchef::Operation *TFliteOpPow::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+ operation->set_type("Pow");
+
+ // PowOptions are empty
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Pow.h b/compiler/tflchef/tflite/src/Op/Pow.h
new file mode 100644
index 000000000..20e847377
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Pow.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_POW_H__
+#define __TFLITE_OP_POW_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Pow
+ */
+class TFliteOpPow : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_POW_H__
diff --git a/compiler/tflchef/tflite/src/Op/Range.cpp b/compiler/tflchef/tflite/src/Op/Range.cpp
new file mode 100644
index 000000000..2958b9c41
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Range.cpp
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Range.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpRange::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // filler for all inputs
+ const auto &inputs = *op->inputs();
+
+ for (int index = 0; index < 3; ++index)
+ {
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[index]);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ if (tensor->type() == tflite::TensorType::TensorType_INT32)
+ {
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[index], vec);
+ }
+ else if (tensor->type() == tflite::TensorType::TensorType_FLOAT32)
+ {
+ auto vec = extract_buffer<float>(buffer);
+ import->set_tensor_filler(inputs[index], vec);
+ }
+ else
+ {
+ assert(false && "Invalid tensor type");
+ }
+ }
+}
+
+tflchef::Operation *TFliteOpRange::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Range");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Range.h b/compiler/tflchef/tflite/src/Op/Range.h
new file mode 100644
index 000000000..ad10dc58b
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Range.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_RANGE_H__
+#define __TFLITE_OP_RANGE_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for abs
+ */
+class TFliteOpRange : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_RANGE_H__
diff --git a/compiler/tflchef/tflite/src/Op/Rank.cpp b/compiler/tflchef/tflite/src/Op/Rank.cpp
new file mode 100644
index 000000000..184c8e482
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Rank.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Rank.h"
+
+namespace tflchef
+{
+
+void TFliteOpRank::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpRank::build(const tflite::Operator *, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Rank");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Rank.h b/compiler/tflchef/tflite/src/Op/Rank.h
new file mode 100644
index 000000000..003d9d310
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Rank.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_RANK_H__
+#define __TFLITE_OP_RANK_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for rank
+ */
+class TFliteOpRank : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_RANK_H__
diff --git a/compiler/tflchef/tflite/src/Op/ReLUN1To1.cpp b/compiler/tflchef/tflite/src/Op/ReLUN1To1.cpp
new file mode 100644
index 000000000..4cc8dbd2b
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ReLUN1To1.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ReLUN1To1.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpReLUN1To1::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpReLUN1To1::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("ReLUN1To1");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/ReLUN1To1.h b/compiler/tflchef/tflite/src/Op/ReLUN1To1.h
new file mode 100644
index 000000000..0767006af
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ReLUN1To1.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_RELU_N1_TO_1_H__
+#define __TFLITE_OP_RELU_N1_TO_1_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for RELU_N1_TO_1
+ */
+class TFliteOpReLUN1To1 : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_RELU_N1_TO_1_H__
diff --git a/compiler/tflchef/tflite/src/Op/ReduceAny.cpp b/compiler/tflchef/tflite/src/Op/ReduceAny.cpp
new file mode 100644
index 000000000..e0cc503c4
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ReduceAny.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ReduceAny.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpReduceAny::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // filler for second input
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[1]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+}
+
+tflchef::Operation *TFliteOpReduceAny::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+ operation->set_type("ReduceAny");
+
+ auto op_params = op->builtin_options_as_ReducerOptions();
+ assert(op_params != nullptr);
+
+ auto op_options = operation->mutable_reduce_any_options();
+ op_options->set_keep_dims(op_params->keep_dims());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/ReduceAny.h b/compiler/tflchef/tflite/src/Op/ReduceAny.h
new file mode 100644
index 000000000..dd5e361d5
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ReduceAny.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_REDUCE_ANY_H__
+#define __TFLITE_OP_REDUCE_ANY_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for REDUCE_ANY
+ */
+class TFliteOpReduceAny : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_REDUCE_ANY_H__
diff --git a/compiler/tflchef/tflite/src/Op/ReduceMax.cpp b/compiler/tflchef/tflite/src/Op/ReduceMax.cpp
new file mode 100644
index 000000000..499f58566
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ReduceMax.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ReduceMax.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpReduceMax::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // filler for second input
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[1]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+}
+
+tflchef::Operation *TFliteOpReduceMax::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_ReducerOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("ReduceMax");
+
+ auto op_options = operation->mutable_reduce_max_options();
+
+ op_options->set_keep_dims(op_params->keep_dims());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/ReduceMax.h b/compiler/tflchef/tflite/src/Op/ReduceMax.h
new file mode 100644
index 000000000..8e65cf47c
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ReduceMax.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_REDUCEMAX_H__
+#define __TFLITE_OP_REDUCEMAX_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Reduce Max
+ */
+class TFliteOpReduceMax : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_REDUCEMAX_H__
diff --git a/compiler/tflchef/tflite/src/Op/ReduceMin.cpp b/compiler/tflchef/tflite/src/Op/ReduceMin.cpp
new file mode 100644
index 000000000..09e2e134c
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ReduceMin.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ReduceMin.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpReduceMin::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // filler for second input
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[1]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+}
+
+tflchef::Operation *TFliteOpReduceMin::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_ReducerOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("ReduceMin");
+
+ auto op_options = operation->mutable_reduce_min_options();
+
+ op_options->set_keep_dims(op_params->keep_dims());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/ReduceMin.h b/compiler/tflchef/tflite/src/Op/ReduceMin.h
new file mode 100644
index 000000000..88cba6fe7
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ReduceMin.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_REDUCEMIN_H__
+#define __TFLITE_OP_REDUCEMIN_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Reduce Min
+ */
+class TFliteOpReduceMin : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_REDUCEMIN_H__
diff --git a/compiler/tflchef/tflite/src/Op/ReduceProd.cpp b/compiler/tflchef/tflite/src/Op/ReduceProd.cpp
new file mode 100644
index 000000000..e2d98970d
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ReduceProd.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ReduceProd.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpReduceProd::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // filler for second input
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[1]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+}
+
+tflchef::Operation *TFliteOpReduceProd::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+ operation->set_type("ReduceProd");
+
+ auto op_params = op->builtin_options_as_ReducerOptions();
+ assert(op_params != nullptr);
+
+ auto op_options = operation->mutable_reduce_prod_options();
+ op_options->set_keep_dims(op_params->keep_dims());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/ReduceProd.h b/compiler/tflchef/tflite/src/Op/ReduceProd.h
new file mode 100644
index 000000000..e7766840a
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ReduceProd.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_REDUCE_PROD_H__
+#define __TFLITE_OP_REDUCE_PROD_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for REDUCE_PROD
+ */
+class TFliteOpReduceProd : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_REDUCE_PROD_H__
diff --git a/compiler/tflchef/tflite/src/Op/Reshape.cpp b/compiler/tflchef/tflite/src/Op/Reshape.cpp
index 663ab3ec3..0094d5df5 100644
--- a/compiler/tflchef/tflite/src/Op/Reshape.cpp
+++ b/compiler/tflchef/tflite/src/Op/Reshape.cpp
@@ -17,6 +17,7 @@
#include "Reshape.h"
#include "Convert.h"
+#include "FillerHelper.h"
namespace tflchef
{
@@ -27,33 +28,29 @@ void TFliteOpReshape::filler(const tflite::Operator *op, TFliteImport *import,
const std::vector<int32_t> &inputs = as_index_vector(op->inputs());
bool hasShape = (inputs.size() == 2);
- assert(inputs.size() == 1 || hasShape);
-
if (hasShape)
{
- auto op_params = op->builtin_options_as_ReshapeOptions();
- std::vector<int32_t> new_shape = as_index_vector(op_params->new_shape());
- import->set_tensor_filler(inputs.at(1), new_shape);
+ fill_tensor_to_import(inputs[1], import);
}
}
tflchef::Operation *TFliteOpReshape::build(const tflite::Operator *op, TFliteImport *import,
tflchef::ModelRecipe *model_recipe) const
{
- auto op_params = op->builtin_options_as_ReshapeOptions();
- assert(op_params != nullptr);
-
auto operation = model_recipe->add_operation();
operation->set_type("Reshape");
- auto op_options = operation->mutable_reshape_options();
-
- std::vector<int32_t> new_shape = as_index_vector(op_params->new_shape());
-
- for (auto shape : new_shape)
+ auto op_params = op->builtin_options_as_ReshapeOptions();
+ if (op_params != nullptr)
{
- op_options->add_new_shape(shape);
+ auto op_options = operation->mutable_reshape_options();
+
+ std::vector<int32_t> new_shape = as_index_vector(op_params->new_shape());
+ for (auto shape : new_shape)
+ {
+ op_options->add_new_shape(shape);
+ }
}
return operation;
diff --git a/compiler/tflchef/tflite/src/Op/ResizeBilinear.cpp b/compiler/tflchef/tflite/src/Op/ResizeBilinear.cpp
new file mode 100644
index 000000000..0f6db1fcb
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ResizeBilinear.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ResizeBilinear.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpResizeBilinear::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // size buffer has filler
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[1]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+
+ if (buffer && buffer->data())
+ {
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+ }
+}
+
+tflchef::Operation *TFliteOpResizeBilinear::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_ResizeBilinearOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("ResizeBilinear");
+
+ auto op_options = operation->mutable_resize_bilinear_options();
+
+ op_options->set_align_corners(op_params->align_corners());
+ op_options->set_half_pixel_centers(op_params->half_pixel_centers());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/ResizeBilinear.h b/compiler/tflchef/tflite/src/Op/ResizeBilinear.h
new file mode 100644
index 000000000..98c49c534
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ResizeBilinear.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_RESIZE_BILINEAR_H__
+#define __TFLITE_OP_RESIZE_BILINEAR_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for ResizeBilinear
+ */
+class TFliteOpResizeBilinear : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_RESIZE_BILINEAR_H__
diff --git a/compiler/tflchef/tflite/src/Op/ResizeNearestNeighbor.cpp b/compiler/tflchef/tflite/src/Op/ResizeNearestNeighbor.cpp
new file mode 100644
index 000000000..f3dd8fed0
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ResizeNearestNeighbor.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ResizeNearestNeighbor.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpResizeNearestNeighbor::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // size buffer has filler
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[1]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+
+ if (buffer && buffer->data())
+ {
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+ }
+}
+
+tflchef::Operation *TFliteOpResizeNearestNeighbor::build(const tflite::Operator *op,
+ TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_ResizeNearestNeighborOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("ResizeNearestNeighbor");
+
+ auto op_options = operation->mutable_resize_nearest_neighbor_options();
+
+ op_options->set_align_corners(op_params->align_corners());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/ResizeNearestNeighbor.h b/compiler/tflchef/tflite/src/Op/ResizeNearestNeighbor.h
new file mode 100644
index 000000000..5090bb938
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ResizeNearestNeighbor.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_RESIZE_NEAREST_NEIGHBOR_H__
+#define __TFLITE_OP_RESIZE_NEAREST_NEIGHBOR_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for ResizeNearestNeighbor
+ */
+class TFliteOpResizeNearestNeighbor : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_RESIZE_NEAREST_NEIGHBOR_H__
diff --git a/compiler/tflchef/tflite/src/Op/ReverseSequence.cpp b/compiler/tflchef/tflite/src/Op/ReverseSequence.cpp
new file mode 100644
index 000000000..6ef6c2326
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ReverseSequence.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ReverseSequence.h"
+
+#include "Convert.h"
+#include "FillerHelper.h"
+
+namespace tflchef
+{
+
+void TFliteOpReverseSequence::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *) const
+{
+ const std::vector<int32_t> &inputs = as_index_vector(op->inputs());
+ assert(inputs.size() == 2);
+
+ fill_tensor_to_import(inputs[1], import);
+}
+
+tflchef::Operation *TFliteOpReverseSequence::build(const tflite::Operator *op, TFliteImport *,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("ReverseSequence");
+
+ auto op_params = op->builtin_options_as_ReverseSequenceOptions();
+
+ assert(op_params != nullptr);
+
+ auto op_options = operation->mutable_reverse_sequence_options();
+
+ op_options->set_seq_dim(op_params->seq_dim());
+ op_options->set_batch_dim(op_params->batch_dim());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/ReverseSequence.h b/compiler/tflchef/tflite/src/Op/ReverseSequence.h
new file mode 100644
index 000000000..8c8c811e4
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ReverseSequence.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_REVERSE_SEQUENCE_H__
+#define __TFLITE_OP_REVERSE_SEQUENCE_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for ReverseSequence
+ */
+class TFliteOpReverseSequence : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_REVERSE_SEQUENCE_H__
diff --git a/compiler/tflchef/tflite/src/Op/ReverseV2.cpp b/compiler/tflchef/tflite/src/Op/ReverseV2.cpp
new file mode 100644
index 000000000..c59d97574
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ReverseV2.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ReverseV2.h"
+
+#include "Convert.h"
+#include "FillerHelper.h"
+
+namespace tflchef
+{
+
+void TFliteOpReverseV2::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *) const
+{
+ const std::vector<int32_t> &inputs = as_index_vector(op->inputs());
+ assert(inputs.size() == 2);
+
+ fill_tensor_to_import(inputs[1], import);
+}
+
+tflchef::Operation *TFliteOpReverseV2::build(const tflite::Operator *, TFliteImport *,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("ReverseV2");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/ReverseV2.h b/compiler/tflchef/tflite/src/Op/ReverseV2.h
new file mode 100644
index 000000000..6a8a75e6b
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ReverseV2.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_REVERSEV2_H__
+#define __TFLITE_OP_REVERSEV2_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for ReverseV2
+ */
+class TFliteOpReverseV2 : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_REVERSEV2_H__
diff --git a/compiler/tflchef/tflite/src/Op/Round.cpp b/compiler/tflchef/tflite/src/Op/Round.cpp
new file mode 100644
index 000000000..c3f6bf6c4
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Round.cpp
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Round.h"
+
+namespace tflchef
+{
+
+void TFliteOpRound::filler(const tflite::Operator *, TFliteImport *, tflchef::ModelRecipe *) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpRound::build(const tflite::Operator *, TFliteImport *,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Round");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Round.h b/compiler/tflchef/tflite/src/Op/Round.h
new file mode 100644
index 000000000..df0da3fa1
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Round.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_ROUND_H__
+#define __TFLITE_OP_ROUND_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Round
+ */
+class TFliteOpRound : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_ROUND_H__
diff --git a/compiler/tflchef/tflite/src/Op/Rsqrt.cpp b/compiler/tflchef/tflite/src/Op/Rsqrt.cpp
new file mode 100644
index 000000000..1639214e4
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Rsqrt.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Rsqrt.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpRsqrt::filler(const tflite::Operator *, TFliteImport *, tflchef::ModelRecipe *) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpRsqrt::build(const tflite::Operator *, TFliteImport *,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Rsqrt");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Rsqrt.h b/compiler/tflchef/tflite/src/Op/Rsqrt.h
new file mode 100644
index 000000000..5d68344c2
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Rsqrt.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_RSQRT_H__
+#define __TFLITE_OP_RSQRT_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Rsqrt
+ */
+class TFliteOpRsqrt : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_RSQRT_H__
diff --git a/compiler/tflchef/tflite/src/Op/ScatterNd.cpp b/compiler/tflchef/tflite/src/Op/ScatterNd.cpp
new file mode 100644
index 000000000..548a09a67
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ScatterNd.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ScatterNd.h"
+
+#include "Convert.h"
+#include "FillerHelper.h"
+
+namespace tflchef
+{
+
+void TFliteOpScatterNd::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Filler for indices and shape
+ fill_tensor_to_import(0, import);
+ fill_tensor_to_import(2, import);
+}
+
+tflchef::Operation *TFliteOpScatterNd::build(const tflite::Operator *, TFliteImport *,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("ScatterNd");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/ScatterNd.h b/compiler/tflchef/tflite/src/Op/ScatterNd.h
new file mode 100644
index 000000000..76362d775
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ScatterNd.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_SCATTER_ND_H__
+#define __TFLITE_OP_SCATTER_ND_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for ScatterNd
+ */
+class TFliteOpScatterNd : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_SCATTER_ND_H__
diff --git a/compiler/tflchef/tflite/src/Op/SegmentSum.cpp b/compiler/tflchef/tflite/src/Op/SegmentSum.cpp
new file mode 100644
index 000000000..a975ca4b3
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/SegmentSum.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "SegmentSum.h"
+
+#include "FillerHelper.h"
+
+namespace tflchef
+{
+
+void TFliteOpSegmentSum::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Filler for indices and shape
+ fill_tensor_to_import(1, import);
+}
+
+tflchef::Operation *TFliteOpSegmentSum::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("SegmentSum");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/SegmentSum.h b/compiler/tflchef/tflite/src/Op/SegmentSum.h
new file mode 100644
index 000000000..d20e63bd7
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/SegmentSum.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_SEGMENT_SUM_H__
+#define __TFLITE_OP_SEGMENT_SUM_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for SEGMENT_SUM
+ */
+class TFliteOpSegmentSum : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_SEGMENT_SUM_H__
diff --git a/compiler/tflchef/tflite/src/Op/Select.cpp b/compiler/tflchef/tflite/src/Op/Select.cpp
new file mode 100644
index 000000000..741ffb8f6
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Select.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Select.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpSelect::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpSelect::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Select");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Select.h b/compiler/tflchef/tflite/src/Op/Select.h
new file mode 100644
index 000000000..bf8e57d78
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Select.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_SELECT_H__
+#define __TFLITE_OP_SELECT_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for SELECT
+ */
+class TFliteOpSelect : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_SELECT_H__
diff --git a/compiler/tflchef/tflite/src/Op/SelectV2.cpp b/compiler/tflchef/tflite/src/Op/SelectV2.cpp
new file mode 100644
index 000000000..0ddabb4be
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/SelectV2.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "SelectV2.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpSelectV2::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpSelectV2::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("SelectV2");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/SelectV2.h b/compiler/tflchef/tflite/src/Op/SelectV2.h
new file mode 100644
index 000000000..ff03341d7
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/SelectV2.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_SELECT_V2_H__
+#define __TFLITE_OP_SELECT_V2_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for SELECT
+ */
+class TFliteOpSelectV2 : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_SELECT_V2_H__
diff --git a/compiler/tflchef/tflite/src/Op/Shape.cpp b/compiler/tflchef/tflite/src/Op/Shape.cpp
new file mode 100644
index 000000000..d6e490d63
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Shape.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Shape.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpShape::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpShape::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+ operation->set_type("Shape");
+
+ auto op_params = op->builtin_options_as_ShapeOptions();
+ assert(op_params != nullptr);
+
+ auto op_options = operation->mutable_shape_options();
+ op_options->set_out_type(as_tflchef_type(op_params->out_type()));
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Shape.h b/compiler/tflchef/tflite/src/Op/Shape.h
new file mode 100644
index 000000000..ebe1befb3
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Shape.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_SHAPE_H__
+#define __TFLITE_OP_SHAPE_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for SHAPE
+ */
+class TFliteOpShape : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_SHAPE_H__
diff --git a/compiler/tflchef/tflite/src/Op/Sin.cpp b/compiler/tflchef/tflite/src/Op/Sin.cpp
new file mode 100644
index 000000000..8c063f424
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Sin.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Sin.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpSin::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpSin::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Sin");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Sin.h b/compiler/tflchef/tflite/src/Op/Sin.h
new file mode 100644
index 000000000..51eabceb5
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Sin.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_SIN_H__
+#define __TFLITE_OP_SIN_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Sin
+ */
+class TFliteOpSin : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_SIN_H__
diff --git a/compiler/tflchef/tflite/src/Op/Slice.cpp b/compiler/tflchef/tflite/src/Op/Slice.cpp
new file mode 100644
index 000000000..f0c44da2d
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Slice.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Slice.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpSlice::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ const std::vector<int32_t> &inputs = as_index_vector(op->inputs());
+
+ // for begin and size
+ for (int32_t index = 1; index <= 2; ++index)
+ {
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[index]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[index], vec);
+ }
+}
+
+tflchef::Operation *TFliteOpSlice::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Slice");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Slice.h b/compiler/tflchef/tflite/src/Op/Slice.h
new file mode 100644
index 000000000..6ca6724d3
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Slice.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_SLICE_H__
+#define __TFLITE_OP_SLICE_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for SLICE
+ */
+class TFliteOpSlice : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_SLICE_H__
diff --git a/compiler/tflchef/tflite/src/Op/Softmax.cpp b/compiler/tflchef/tflite/src/Op/Softmax.cpp
new file mode 100644
index 000000000..5b5c94f7e
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Softmax.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Softmax.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpSoftmax::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpSoftmax::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_SoftmaxOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Softmax");
+
+ auto op_options = operation->mutable_softmax_options();
+
+ op_options->set_beta(op_params->beta());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Softmax.h b/compiler/tflchef/tflite/src/Op/Softmax.h
new file mode 100644
index 000000000..cf168bdd9
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Softmax.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_SOFTMAX_H__
+#define __TFLITE_OP_SOFTMAX_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Softmax
+ */
+class TFliteOpSoftmax : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_SOFTMAX_H__
diff --git a/compiler/tflchef/tflite/src/Op/SpaceToBatchND.cpp b/compiler/tflchef/tflite/src/Op/SpaceToBatchND.cpp
new file mode 100644
index 000000000..9de0775a9
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/SpaceToBatchND.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "SpaceToBatchND.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpSpaceToBatchND::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // filler for second, third input
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[1]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+
+ tensor = import->tensors()->Get(inputs[2]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ buffer = import->buffers()->Get(tensor->buffer());
+ vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[2], vec);
+}
+
+tflchef::Operation *TFliteOpSpaceToBatchND::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("SpaceToBatchND");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/SpaceToBatchND.h b/compiler/tflchef/tflite/src/Op/SpaceToBatchND.h
new file mode 100644
index 000000000..9d7bc44e8
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/SpaceToBatchND.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_SPACETOBATCHND_H__
+#define __TFLITE_OP_SPACETOBATCHND_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for SpaceToBatchND
+ */
+class TFliteOpSpaceToBatchND : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_SPACETOBATCHND_H__
diff --git a/compiler/tflchef/tflite/src/Op/SpaceToDepth.cpp b/compiler/tflchef/tflite/src/Op/SpaceToDepth.cpp
new file mode 100644
index 000000000..e5718b515
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/SpaceToDepth.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "SpaceToDepth.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpSpaceToDepth::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpSpaceToDepth::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("SpaceToDepth");
+
+ auto op_params = op->builtin_options_as_SpaceToDepthOptions();
+ assert(op_params != nullptr);
+
+ auto op_options = operation->mutable_space_to_depth_options();
+
+ op_options->set_block_size(op_params->block_size());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/SpaceToDepth.h b/compiler/tflchef/tflite/src/Op/SpaceToDepth.h
new file mode 100644
index 000000000..784ad940a
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/SpaceToDepth.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_SPACETODEPTH_H__
+#define __TFLITE_OP_SPACETODEPTH_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for SpaceToDepth
+ */
+class TFliteOpSpaceToDepth : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_SPACETODEPTH_H__
diff --git a/compiler/tflchef/tflite/src/Op/SparseToDense.cpp b/compiler/tflchef/tflite/src/Op/SparseToDense.cpp
new file mode 100644
index 000000000..9e4f0a067
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/SparseToDense.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "SparseToDense.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpSparseToDense::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // filler for Shape
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *output_shape_tensor = import->tensors()->Get(inputs[1]);
+ assert(output_shape_tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(output_shape_tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+}
+
+tflchef::Operation *TFliteOpSparseToDense::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_SparseToDenseOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("SparseToDense");
+
+ auto op_options = operation->mutable_sparse_to_dense_options();
+
+ op_options->set_validate_indices(op_params->validate_indices());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/SparseToDense.h b/compiler/tflchef/tflite/src/Op/SparseToDense.h
new file mode 100644
index 000000000..5ffe4789d
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/SparseToDense.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_SPARSETODENSE_H__
+#define __TFLITE_OP_SPARSETODENSE_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for SparseToDense
+ */
+class TFliteOpSparseToDense : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_SPARSETODENSE_H__
diff --git a/compiler/tflchef/tflite/src/Op/Split.cpp b/compiler/tflchef/tflite/src/Op/Split.cpp
new file mode 100644
index 000000000..49f9aa2c6
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Split.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Split.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpSplit::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ const auto &inputs = *op->inputs();
+
+ // for input split_dim
+ // NOTE unlike other Ops, Split input 0 is split_dim
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[0]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[0], vec);
+}
+
+tflchef::Operation *TFliteOpSplit::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Split");
+
+ auto op_options = operation->mutable_split_options();
+
+ auto op_params = op->builtin_options_as_SplitOptions();
+ assert(op_params != nullptr);
+
+ op_options->set_num_splits(op_params->num_splits());
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Split.h b/compiler/tflchef/tflite/src/Op/Split.h
new file mode 100644
index 000000000..af247a1b9
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Split.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_SPLIT_H__
+#define __TFLITE_OP_SPLIT_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for SPLIT
+ */
+class TFliteOpSplit : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_SPLIT_H__
diff --git a/compiler/tflchef/tflite/src/Op/SplitV.cpp b/compiler/tflchef/tflite/src/Op/SplitV.cpp
new file mode 100644
index 000000000..18035e6f4
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/SplitV.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "SplitV.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpSplitV::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ const auto &inputs = *op->inputs();
+
+ // for input "size_splits" and "split_dim"
+ for (int32_t idx = 1; idx <= 2; idx++)
+ {
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[idx]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[idx], vec);
+ }
+}
+
+tflchef::Operation *TFliteOpSplitV::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("SplitV");
+
+ auto op_options = operation->mutable_split_v_options();
+
+ auto op_params = op->builtin_options_as_SplitVOptions();
+ assert(op_params != nullptr);
+
+ op_options->set_num_splits(op_params->num_splits());
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/SplitV.h b/compiler/tflchef/tflite/src/Op/SplitV.h
new file mode 100644
index 000000000..3f715b5f9
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/SplitV.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_SPLIT_V_H__
+#define __TFLITE_OP_SPLIT_V_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for SPLIT_V
+ */
+class TFliteOpSplitV : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_SPLIT_V_H__
diff --git a/compiler/tflchef/tflite/src/Op/Sqrt.cpp b/compiler/tflchef/tflite/src/Op/Sqrt.cpp
index 5d967d66f..dd6bfcab0 100644
--- a/compiler/tflchef/tflite/src/Op/Sqrt.cpp
+++ b/compiler/tflchef/tflite/src/Op/Sqrt.cpp
@@ -25,6 +25,19 @@ void TFliteOpSqrt::filler(const tflite::Operator *op, TFliteImport *import,
tflchef::ModelRecipe *model_recipe) const
{
// Nothing to do with filler
+ // But input has filler for constant inputs
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[0]);
+ if (tensor->type() == tflite::TensorType::TensorType_FLOAT32)
+ {
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ if (buffer && buffer->data())
+ {
+ auto vec = extract_buffer<float>(buffer);
+ import->set_tensor_filler(inputs[0], vec);
+ }
+ }
}
tflchef::Operation *TFliteOpSqrt::build(const tflite::Operator *op, TFliteImport *import,
diff --git a/compiler/tflchef/tflite/src/Op/Square.cpp b/compiler/tflchef/tflite/src/Op/Square.cpp
new file mode 100644
index 000000000..d3803284a
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Square.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Square.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpSquare::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpSquare::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Square");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Square.h b/compiler/tflchef/tflite/src/Op/Square.h
new file mode 100644
index 000000000..9c008fe52
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Square.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_SQUARE_H__
+#define __TFLITE_OP_SQUARE_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Square
+ */
+class TFliteOpSquare : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_SQUARE_H__
diff --git a/compiler/tflchef/tflite/src/Op/SquaredDifference.cpp b/compiler/tflchef/tflite/src/Op/SquaredDifference.cpp
new file mode 100644
index 000000000..1ee536e76
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/SquaredDifference.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "SquaredDifference.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpSquaredDifference::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpSquaredDifference::build(const tflite::Operator *op,
+ TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("SquaredDifference");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/SquaredDifference.h b/compiler/tflchef/tflite/src/Op/SquaredDifference.h
new file mode 100644
index 000000000..58c2ed460
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/SquaredDifference.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_SQUAREDDIFFERENCE_H__
+#define __TFLITE_OP_SQUAREDDIFFERENCE_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for SquaredDifference
+ */
+class TFliteOpSquaredDifference : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_SQUAREDDIFFERENCE_H__
diff --git a/compiler/tflchef/tflite/src/Op/Squeeze.cpp b/compiler/tflchef/tflite/src/Op/Squeeze.cpp
new file mode 100644
index 000000000..7983fc62a
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Squeeze.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Squeeze.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpSqueeze::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpSqueeze::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_SqueezeOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Squeeze");
+
+ auto op_options = operation->mutable_squeeze_options();
+
+ std::vector<int32_t> squeeze_dims = as_index_vector(op_params->squeeze_dims());
+
+ for (auto dim : squeeze_dims)
+ {
+ op_options->add_squeeze_dim(dim);
+ }
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Squeeze.h b/compiler/tflchef/tflite/src/Op/Squeeze.h
new file mode 100644
index 000000000..b6c89f73d
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Squeeze.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_SQUEEZE_H__
+#define __TFLITE_OP_SQUEEZE_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Squeeze
+ */
+class TFliteOpSqueeze : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_SQUEEZE_H__
diff --git a/compiler/tflchef/tflite/src/Op/StridedSlice.cpp b/compiler/tflchef/tflite/src/Op/StridedSlice.cpp
new file mode 100644
index 000000000..c770236c7
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/StridedSlice.cpp
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "StridedSlice.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpStridedSlice::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ const std::vector<int32_t> &inputs = as_index_vector(op->inputs());
+
+ // for begin, end and strides
+ for (int32_t index = 1; index <= 3; ++index)
+ {
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[index]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[index], vec);
+ }
+}
+
+tflchef::Operation *TFliteOpStridedSlice::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_StridedSliceOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("StridedSlice");
+
+ auto op_options = operation->mutable_strided_slice_options();
+
+ op_options->set_begin_mask(op_params->begin_mask());
+ op_options->set_end_mask(op_params->end_mask());
+ op_options->set_ellipsis_mask(op_params->ellipsis_mask());
+ op_options->set_new_axis_mask(op_params->new_axis_mask());
+ op_options->set_shrink_axis_mask(op_params->shrink_axis_mask());
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/StridedSlice.h b/compiler/tflchef/tflite/src/Op/StridedSlice.h
new file mode 100644
index 000000000..98054b9b9
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/StridedSlice.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_STRIDEDSLICE_H__
+#define __TFLITE_OP_STRIDEDSLICE_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for StridedSlice
+ */
+class TFliteOpStridedSlice : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_STRIDEDSLICE_H__
diff --git a/compiler/tflchef/tflite/src/Op/Sub.cpp b/compiler/tflchef/tflite/src/Op/Sub.cpp
index db77fddf7..0a08bbfdf 100644
--- a/compiler/tflchef/tflite/src/Op/Sub.cpp
+++ b/compiler/tflchef/tflite/src/Op/Sub.cpp
@@ -17,6 +17,7 @@
#include "Sub.h"
#include "Convert.h"
+#include "FillerHelper.h"
namespace tflchef
{
@@ -24,7 +25,13 @@ namespace tflchef
void TFliteOpSub::filler(const tflite::Operator *op, TFliteImport *import,
tflchef::ModelRecipe *model_recipe) const
{
- // Nothing to do with filler
+ // Sub may have constant input
+
+ const std::vector<int32_t> &inputs = as_index_vector(op->inputs());
+ assert(inputs.size() == 2);
+
+ fill_tensor_to_import(inputs[0], import);
+ fill_tensor_to_import(inputs[1], import);
}
tflchef::Operation *TFliteOpSub::build(const tflite::Operator *op, TFliteImport *import,
diff --git a/compiler/tflchef/tflite/src/Op/Sum.cpp b/compiler/tflchef/tflite/src/Op/Sum.cpp
new file mode 100644
index 000000000..9f3133e85
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Sum.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Sum.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpSum::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // filler for second input
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[1]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+}
+
+tflchef::Operation *TFliteOpSum::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_ReducerOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Sum");
+
+ auto op_options = operation->mutable_sum_options();
+
+ op_options->set_keep_dims(op_params->keep_dims());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Sum.h b/compiler/tflchef/tflite/src/Op/Sum.h
new file mode 100644
index 000000000..38eeb080d
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Sum.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_SUM_H__
+#define __TFLITE_OP_SUM_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for sum
+ */
+class TFliteOpSum : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_SUM_H__
diff --git a/compiler/tflchef/tflite/src/Op/Tanh.cpp b/compiler/tflchef/tflite/src/Op/Tanh.cpp
new file mode 100644
index 000000000..cab8ca460
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Tanh.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Tanh.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpTanh::filler(const tflite::Operator *, TFliteImport *, tflchef::ModelRecipe *) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpTanh::build(const tflite::Operator *, TFliteImport *,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Tanh");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Tanh.h b/compiler/tflchef/tflite/src/Op/Tanh.h
new file mode 100644
index 000000000..7339e4103
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Tanh.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_TANH_H__
+#define __TFLITE_OP_TANH_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Tanh
+ */
+class TFliteOpTanh : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_TANH_H__
diff --git a/compiler/tflchef/tflite/src/Op/Tile.cpp b/compiler/tflchef/tflite/src/Op/Tile.cpp
new file mode 100644
index 000000000..14e65131c
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Tile.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Tile.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpTile::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // filler for second input
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[1]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32 ||
+ tensor->type() == tflite::TensorType::TensorType_INT64);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+}
+
+tflchef::Operation *TFliteOpTile::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Tile");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Tile.h b/compiler/tflchef/tflite/src/Op/Tile.h
new file mode 100644
index 000000000..640f52a1f
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Tile.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_TILE_H__
+#define __TFLITE_OP_TILE_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Tile
+ */
+class TFliteOpTile : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_TILE_H__
diff --git a/compiler/tflchef/tflite/src/Op/TopKV2.cpp b/compiler/tflchef/tflite/src/Op/TopKV2.cpp
new file mode 100644
index 000000000..461456ae2
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/TopKV2.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TopKV2.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpTopKV2::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // filler for second input
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[1]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32 ||
+ tensor->type() == tflite::TensorType::TensorType_INT64);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+}
+
+tflchef::Operation *TFliteOpTopKV2::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("TopKV2");
+
+ // NOTE there is `sorted` attribute in TF but it's always true for TFlite
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/TopKV2.h b/compiler/tflchef/tflite/src/Op/TopKV2.h
new file mode 100644
index 000000000..b2b74cc75
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/TopKV2.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_TOPK_V2_H__
+#define __TFLITE_OP_TOPK_V2_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for TOPK_V2
+ */
+class TFliteOpTopKV2 : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_TOPK_V2_H__
diff --git a/compiler/tflchef/tflite/src/Op/Transpose.cpp b/compiler/tflchef/tflite/src/Op/Transpose.cpp
new file mode 100644
index 000000000..a997bb08e
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Transpose.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Transpose.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpTranspose::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *perm_tensor = import->tensors()->Get(inputs[1]);
+ assert(perm_tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(perm_tensor->buffer());
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[1], vec);
+}
+
+tflchef::Operation *TFliteOpTranspose::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Transpose");
+
+ // No options for Transpose
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Transpose.h b/compiler/tflchef/tflite/src/Op/Transpose.h
new file mode 100644
index 000000000..f0d944b6b
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Transpose.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_TRANSPOSE_H__
+#define __TFLITE_OP_TRANSPOSE_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Transpose
+ */
+class TFliteOpTranspose : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_TRANSPOSE_H__
diff --git a/compiler/tflchef/tflite/src/Op/TransposeConv.cpp b/compiler/tflchef/tflite/src/Op/TransposeConv.cpp
new file mode 100644
index 000000000..4e7adf6c6
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/TransposeConv.cpp
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TransposeConv.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpTransposeConv::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ const auto &inputs = *op->inputs();
+
+ const tflite::Tensor *tensor = import->tensors()->Get(inputs[0]);
+ assert(tensor->type() == tflite::TensorType::TensorType_INT32);
+ const tflite::Buffer *buffer = import->buffers()->Get(tensor->buffer());
+
+ if (buffer && buffer->data())
+ {
+ auto vec = extract_buffer<int32_t>(buffer);
+ import->set_tensor_filler(inputs[0], vec);
+ }
+
+ // filter
+ const tflite::Tensor *filter_tensor = import->tensors()->Get(inputs[1]);
+ import->set_tensor_filler(inputs[1]);
+}
+
+tflchef::Operation *TFliteOpTransposeConv::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_TransposeConvOptions();
+
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("TransposeConv");
+
+ auto op_options = operation->mutable_transpose_conv_options();
+
+ op_options->set_stride_h(op_params->stride_h());
+ op_options->set_stride_w(op_params->stride_w());
+ op_options->set_padding(as_tflchef_padding(op_params->padding()));
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/TransposeConv.h b/compiler/tflchef/tflite/src/Op/TransposeConv.h
new file mode 100644
index 000000000..c79cdabd2
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/TransposeConv.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_TRANSPOSE_CONV_H__
+#define __TFLITE_OP_TRANSPOSE_CONV_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for TransposeConv
+ */
+class TFliteOpTransposeConv : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_TRANSPOSE_CONV_H__
diff --git a/compiler/tflchef/tflite/src/Op/UnidirectionalSequenceLSTM.cpp b/compiler/tflchef/tflite/src/Op/UnidirectionalSequenceLSTM.cpp
new file mode 100644
index 000000000..c2c79285b
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/UnidirectionalSequenceLSTM.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "UnidirectionalSequenceLSTM.h"
+
+#include "Convert.h"
+#include "FillerHelper.h"
+
+namespace tflchef
+{
+
+void TFliteOpUnidirectionalSequenceLSTM::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ const std::vector<int32_t> &inputs = as_index_vector(op->inputs());
+ assert(inputs.size() == 24);
+
+ for (int32_t i = 0; i < inputs.size(); i++)
+ {
+ // Except for Input 0, 17 and 18.
+ // Each Input mean Input[0](=Input Tensor), Input[17](=OutputState Tensor) and
+ // Input[18](=CellState Tensor).
+ // This could be updated from previous input or User Given data, so This could not be Const
+ if (i == 0 || i == 17 || i == 18)
+ continue;
+ if (inputs[i] != -1)
+ fill_tensor_to_import(inputs[i], import);
+ }
+}
+
+tflchef::Operation *
+TFliteOpUnidirectionalSequenceLSTM::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_UnidirectionalSequenceLSTMOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("UnidirectionalSequenceLSTM");
+
+ auto op_options = operation->mutable_unidirectional_sequence_lstm_options();
+
+ op_options->set_activation(as_tflchef_activation(op_params->fused_activation_function()));
+ op_options->set_cell_clip(op_params->cell_clip());
+ op_options->set_proj_clip(op_params->proj_clip());
+ op_options->set_time_major(op_params->time_major());
+ op_options->set_asymmetric_quantize_inputs(op_params->asymmetric_quantize_inputs());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/UnidirectionalSequenceLSTM.h b/compiler/tflchef/tflite/src/Op/UnidirectionalSequenceLSTM.h
new file mode 100644
index 000000000..cc4e5fb0f
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/UnidirectionalSequenceLSTM.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_UNIDIRECTIONALSEQUENCELSTM_H__
+#define __TFLITE_OP_UNIDIRECTIONALSEQUENCELSTM_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for UnidirectionalSequenceLSTM
+ */
+class TFliteOpUnidirectionalSequenceLSTM : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_UNIDIRECTIONALSEQUENCELSTM_H__
diff --git a/compiler/tflchef/tflite/src/Op/Unique.cpp b/compiler/tflchef/tflite/src/Op/Unique.cpp
new file mode 100644
index 000000000..e3f77f40e
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Unique.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Unique.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpUnique::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpUnique::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto op_params = op->builtin_options_as_UniqueOptions();
+ assert(op_params != nullptr);
+
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Unique");
+
+ auto op_options = operation->mutable_unique_options();
+
+ op_options->set_idx_out_type(as_tflchef_type(op_params->idx_out_type()));
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Unique.h b/compiler/tflchef/tflite/src/Op/Unique.h
new file mode 100644
index 000000000..fae037c9f
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Unique.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_UNIQUE_H__
+#define __TFLITE_OP_UNIQUE_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Unique
+ */
+class TFliteOpUnique : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_UNIQUE_H__
diff --git a/compiler/tflchef/tflite/src/Op/Unpack.cpp b/compiler/tflchef/tflite/src/Op/Unpack.cpp
new file mode 100644
index 000000000..a51ef84ef
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Unpack.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Unpack.h"
+
+namespace tflchef
+{
+
+void TFliteOpUnpack::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with filler
+}
+
+tflchef::Operation *TFliteOpUnpack::build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+
+ operation->set_type("Unpack");
+
+ auto op_params = op->builtin_options_as_UnpackOptions();
+ assert(op_params != nullptr);
+
+ auto op_options = operation->mutable_unpack_options();
+ op_options->set_num(op_params->num());
+ op_options->set_axis(op_params->axis());
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Unpack.h b/compiler/tflchef/tflite/src/Op/Unpack.h
new file mode 100644
index 000000000..1036bdc14
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Unpack.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_UNPACK_H__
+#define __TFLITE_OP_UNPACK_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Unpack
+ */
+class TFliteOpUnpack : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_UNPACK_H__
diff --git a/compiler/tflchef/tflite/src/Op/Where.cpp b/compiler/tflchef/tflite/src/Op/Where.cpp
new file mode 100644
index 000000000..e42de3737
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Where.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Where.h"
+
+namespace tflchef
+{
+
+void TFliteOpWhere::filler(const tflite::Operator *, TFliteImport *, tflchef::ModelRecipe *) const
+{
+ // Nothing to do with fillers here
+}
+
+tflchef::Operation *TFliteOpWhere::build(const tflite::Operator *, TFliteImport *,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+ operation->set_type("Where");
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/Where.h b/compiler/tflchef/tflite/src/Op/Where.h
new file mode 100644
index 000000000..00cdc4b00
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/Where.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_WHERE_H__
+#define __TFLITE_OP_WHERE_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for Where
+ */
+class TFliteOpWhere : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_WHERE_H__
diff --git a/compiler/tflchef/tflite/src/Op/ZerosLike.cpp b/compiler/tflchef/tflite/src/Op/ZerosLike.cpp
new file mode 100644
index 000000000..a56b6bdfb
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ZerosLike.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ZerosLike.h"
+
+#include "Convert.h"
+
+namespace tflchef
+{
+
+void TFliteOpZerosLike::filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ // Nothing to do with fillers here
+}
+
+tflchef::Operation *TFliteOpZerosLike::build(const tflite::Operator *op, TFliteImport *,
+ tflchef::ModelRecipe *model_recipe) const
+{
+ auto operation = model_recipe->add_operation();
+ operation->set_type("ZerosLike");
+
+ auto op_options = operation->mutable_zeros_like_options();
+ (void)op_options;
+
+ return operation;
+}
+
+} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/Op/ZerosLike.h b/compiler/tflchef/tflite/src/Op/ZerosLike.h
new file mode 100644
index 000000000..163c1fa21
--- /dev/null
+++ b/compiler/tflchef/tflite/src/Op/ZerosLike.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TFLITE_OP_ZEROS_LIKE_H__
+#define __TFLITE_OP_ZEROS_LIKE_H__
+
+#include "TFliteOpChef.h"
+
+namespace tflchef
+{
+
+/**
+ * @brief tflchef operator builder for ZerosLike
+ */
+class TFliteOpZerosLike : public TFliteOpChef
+{
+public:
+ void filler(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+ tflchef::Operation *build(const tflite::Operator *op, TFliteImport *import,
+ tflchef::ModelRecipe *model_recipe) const override;
+};
+
+} // namespace tflchef
+
+#endif // __TFLITE_OP_ZEROS_LIKE_H__
diff --git a/compiler/tflchef/tflite/src/RawModelLoader.cpp b/compiler/tflchef/tflite/src/RawModelLoader.cpp
deleted file mode 100644
index e9ef8ec8b..000000000
--- a/compiler/tflchef/tflite/src/RawModelLoader.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <tflchef/RawModel.h>
-
-#include <cwrap/Fildes.h>
-
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-
-namespace
-{
-
-class MemoryMappedRawModel final : public tflchef::RawModel
-{
-public:
- /**
- * @require fd and data SHOULD be valid
- */
- explicit MemoryMappedRawModel(int fd, void *data, size_t size) : _fd{fd}, _data{data}, _size{size}
- {
- // DO NOTHING
- }
-
-public:
- ~MemoryMappedRawModel()
- {
- munmap(_data, _size);
- close(_fd);
- }
-
-public:
- MemoryMappedRawModel(const MemoryMappedRawModel &) = delete;
- MemoryMappedRawModel(MemoryMappedRawModel &&) = delete;
-
-public:
- const ::tflite::Model *model(void) const override { return ::tflite::GetModel(_data); }
-
-private:
- int _fd = -1;
- void *_data = nullptr;
- size_t _size = 0;
-};
-
-} // namespace
-
-namespace tflchef
-{
-
-std::unique_ptr<RawModel> load_tflite(const std::string &path)
-{
- cwrap::Fildes fildes{open(path.c_str(), O_RDONLY)};
-
- if (fildes.get() == -1)
- {
- // Return nullptr on open failure
- return nullptr;
- }
-
- struct stat st;
- if (fstat(fildes.get(), &st) == -1)
- {
- // Return nullptr on fstat failure
- return nullptr;
- }
-
- auto size = st.st_size;
- auto data = mmap(nullptr, size, PROT_READ, MAP_SHARED, fildes.get(), 0);
-
- if (data == MAP_FAILED)
- {
- // Return nullptr on mmap failure
- return nullptr;
- }
-
- return std::unique_ptr<tflchef::RawModel>{new MemoryMappedRawModel(fildes.release(), data, size)};
-}
-
-} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/RecipeChef.cpp b/compiler/tflchef/tflite/src/RecipeChef.cpp
index 0a26ae066..d9215a4c4 100644
--- a/compiler/tflchef/tflite/src/RecipeChef.cpp
+++ b/compiler/tflchef/tflite/src/RecipeChef.cpp
@@ -35,9 +35,16 @@ void set_inputs(TFliteImport *import, tflchef::Operation *operation, const tflit
for (auto input : inputs)
{
- auto tensor = tensors->Get(input);
- std::string name = tensor_name(tensor);
- operation->add_input(name);
+ if (input == -1)
+ {
+ operation->add_input("");
+ }
+ else
+ {
+ auto tensor = tensors->Get(input);
+ std::string name = tensor_name(tensor);
+ operation->add_input(name);
+ }
}
}
@@ -103,16 +110,21 @@ std::unique_ptr<ModelRecipe> generate_recipe(const tflite::Model *model)
operand->set_name(tensor_name(tensor));
operand->set_type(as_tflchef_type(tensor->type()));
+ operand->set_is_variable(tensor->is_variable());
- std::vector<int32_t> dims = as_index_vector(tensor->shape());
- ::tflchef::TensorShape *shape = operand->mutable_shape();
- for (auto dim : dims)
+ if (tensor->shape())
{
- shape->add_dim(dim);
+ std::vector<int32_t> dims = as_index_vector(tensor->shape());
+ ::tflchef::TensorShape *shape = operand->mutable_shape();
+ for (auto dim : dims)
+ {
+ shape->add_dim(dim);
+ }
}
// filler for weights, bias and so on
std::vector<int32_t> expvalues;
+ std::vector<float> expfvalues;
if (tflite_import.get_tensor_filler(i))
{
tflchef::TensorFiller *filler = operand->mutable_filler();
@@ -132,6 +144,17 @@ std::unique_ptr<ModelRecipe> generate_recipe(const tflite::Model *model)
filler->add_arg(ss.str());
}
}
+ else if (tflite_import.get_tensor_filler(i, expfvalues))
+ {
+ tflchef::TensorFiller *filler = operand->mutable_filler();
+ filler->set_tag("explicit");
+ for (auto value : expfvalues)
+ {
+ std::ostringstream ss;
+ ss << value;
+ filler->add_arg(ss.str());
+ }
+ }
auto quant = tensor->quantization();
if (quant != nullptr)
@@ -162,6 +185,101 @@ std::unique_ptr<ModelRecipe> generate_recipe(const tflite::Model *model)
for (uint32_t idx = 0; idx < quant->zero_point()->size(); ++idx)
chef_quant->add_zero_point(quant->zero_point()->Get(idx));
}
+ tflchef::TensorQuantization *chef_quant = operand->mutable_quant();
+ chef_quant->set_quantized_dimension(quant->quantized_dimension());
+ }
+
+ auto sparsity = tensor->sparsity();
+ if (sparsity != nullptr)
+ {
+ tflchef::TensorSparsity *chef_sparsity = operand->mutable_sparsity();
+ // traversal_order
+ auto chef_traversal_order = chef_sparsity->mutable_traversal_order();
+ for (const auto &to : *(sparsity->traversal_order()))
+ {
+ chef_traversal_order->add_dim(to);
+ }
+ // block_map
+ auto chef_block_map = chef_sparsity->mutable_block_map();
+ for (const auto &bm : *(sparsity->block_map()))
+ {
+ chef_block_map->add_dim(bm);
+ }
+ // dim_metadata
+ for (const auto &dm : *(sparsity->dim_metadata()))
+ {
+ auto chef_dm = chef_sparsity->add_dim_metadata();
+ // format
+ chef_dm->set_format(as_tflchef_sparse_dim_type(dm->format()));
+ // dense_size
+ chef_dm->set_dense_size(dm->dense_size());
+ // array_segments
+ auto chef_array_segments = chef_dm->mutable_array_segments();
+ switch (dm->array_segments_type())
+ {
+ case tflite::SparseIndexVector_NONE:
+ // DO NOTHING
+ break;
+ case tflite::SparseIndexVector_Int32Vector:
+ for (const auto &as : *(dm->array_segments_as_Int32Vector()->values()))
+ {
+ chef_array_segments->add_dim(as);
+ }
+ break;
+ case tflite::SparseIndexVector_Uint16Vector:
+ for (const auto &as : *(dm->array_segments_as_Uint16Vector()->values()))
+ {
+ chef_array_segments->add_dim(as);
+ }
+ break;
+ case tflite::SparseIndexVector_Uint8Vector:
+ for (const auto &as : *(dm->array_segments_as_Uint8Vector()->values()))
+ {
+ chef_array_segments->add_dim(as);
+ }
+ break;
+ default:
+ throw std::runtime_error("unsupported sparse index vector type");
+ }
+ // array_indices
+ auto chef_array_indices = chef_dm->mutable_array_indices();
+ switch (dm->array_indices_type())
+ {
+ case tflite::SparseIndexVector_NONE:
+ // DO NOTHING
+ break;
+ case tflite::SparseIndexVector_Int32Vector:
+ for (const auto &as : *(dm->array_indices_as_Int32Vector()->values()))
+ {
+ chef_array_indices->add_dim(as);
+ }
+ break;
+ case tflite::SparseIndexVector_Uint16Vector:
+ for (const auto &as : *(dm->array_indices_as_Uint16Vector()->values()))
+ {
+ chef_array_indices->add_dim(as);
+ }
+ break;
+ case tflite::SparseIndexVector_Uint8Vector:
+ for (const auto &as : *(dm->array_indices_as_Uint8Vector()->values()))
+ {
+ chef_array_indices->add_dim(as);
+ }
+ break;
+ default:
+ throw std::runtime_error("unsupported sparse index vector type");
+ }
+ }
+ }
+
+ auto shape_signature = tensor->shape_signature();
+ if (shape_signature != nullptr)
+ {
+ tflchef::ShapeSignature *chef_shape_signature = operand->mutable_shape_signature();
+ for (uint32_t i = 0; i < shape_signature->size(); ++i)
+ {
+ chef_shape_signature->add_dim(shape_signature->Get(i));
+ }
}
}
diff --git a/compiler/tflchef/tflite/src/TFliteImport.h b/compiler/tflchef/tflite/src/TFliteImport.h
index ade8fc810..9d0a642ab 100644
--- a/compiler/tflchef/tflite/src/TFliteImport.h
+++ b/compiler/tflchef/tflite/src/TFliteImport.h
@@ -17,7 +17,9 @@
#ifndef __TFLITE_IMPORT_H__
#define __TFLITE_IMPORT_H__
-#include <tflite_generated.h>
+#include <mio/tflite/schema_generated.h>
+
+#include <souschef/TensorFiller.h>
#include <tflchef.pb.h>
@@ -40,7 +42,7 @@ bool is_custom(const tflite::OperatorCode *opcode);
/**
* @brief Loads TF lite file and provides helpers to access attributes
*/
-class TFliteImport
+class TFliteImport : public souschef::TensorFiller
{
public:
TFliteImport(const tflite::Model *model);
@@ -63,59 +65,15 @@ public:
std::string opcode_name(const tflite::Operator *op) const;
size_t buffer_info(const tflite::Tensor *tensor, const uint8_t **buff_data);
- /**
- * @brief This will record the tensor by index, if it needs filler option,
- * such as kernel, bias.
- */
- void set_tensor_filler(uint32_t tensor_index) { _tensor_filler[tensor_index] = true; }
-
- /**
- * @brief This will store int32 filler values such as reshape information for the tensor
- */
- void set_tensor_filler(uint32_t tensor_index, std::vector<int32_t> &expvalues)
- {
- _tensor_filler_vint32[tensor_index] = expvalues;
- }
-
- /**
- * @brief This will return true if the tensor by index, needs a filler option.
- */
- bool get_tensor_filler(uint32_t tensor_index)
- {
- auto it = _tensor_filler.find(tensor_index);
- if (it != _tensor_filler.end())
- {
- return it->second;
- }
- return false;
- }
-
- /**
- * @brief This will return true if the tensor by index, needs a int array filler option.
- */
- bool get_tensor_filler(uint32_t tensor_index, std::vector<int32_t> &expvalues)
- {
- auto it = _tensor_filler_vint32.find(tensor_index);
- if (it != _tensor_filler_vint32.end())
- {
- expvalues = it->second;
- return true;
- }
- return false;
- }
-
private:
- const TFliteSubGraphs_t *_subgraphs;
- const TFliteBuffers_t *_buffers;
- const TFliteTensors_t *_tensors;
- const TFliteOperators_t *_operators;
-
- std::vector<const tflite::OperatorCode *> _op_codes;
- std::vector<int32_t> _inputs;
- std::vector<int32_t> _outputs;
-
- std::map<uint32_t, bool> _tensor_filler;
- std::map<uint32_t, std::vector<int32_t>> _tensor_filler_vint32;
+ const TFliteSubGraphs_t *_subgraphs{nullptr};
+ const TFliteBuffers_t *_buffers{nullptr};
+ const TFliteTensors_t *_tensors{nullptr};
+ const TFliteOperators_t *_operators{nullptr};
+
+ std::vector<const tflite::OperatorCode *> _op_codes{};
+ std::vector<int32_t> _inputs{};
+ std::vector<int32_t> _outputs{};
};
} // namespace tflchef
diff --git a/compiler/tflchef/tflite/src/TFliteOpChef.h b/compiler/tflchef/tflite/src/TFliteOpChef.h
index fc9047ce7..98564293b 100644
--- a/compiler/tflchef/tflite/src/TFliteOpChef.h
+++ b/compiler/tflchef/tflite/src/TFliteOpChef.h
@@ -17,7 +17,7 @@
#ifndef __TFLITE_OP_CHEF_H__
#define __TFLITE_OP_CHEF_H__
-#include <tflite_generated.h>
+#include <mio/tflite/schema_generated.h>
#include <tflchef.pb.h>
diff --git a/compiler/tflchef/tflite/src/TFliteOpChefs.h b/compiler/tflchef/tflite/src/TFliteOpChefs.h
index 9f3446840..2e4d28051 100644
--- a/compiler/tflchef/tflite/src/TFliteOpChefs.h
+++ b/compiler/tflchef/tflite/src/TFliteOpChefs.h
@@ -18,17 +18,111 @@
#define __TFLITE_OP_CHEFS_H__
// In alphabet order
+#include "Op/Abs.h"
+#include "Op/Add.h"
+#include "Op/AddN.h"
+#include "Op/ArgMax.h"
+#include "Op/ArgMin.h"
#include "Op/AveragePool2D.h"
+#include "Op/BatchMatMul.h"
+#include "Op/BatchToSpaceND.h"
+#include "Op/Cast.h"
+#include "Op/Ceil.h"
#include "Op/Concatenation.h"
#include "Op/Conv2D.h"
+#include "Op/Cos.h"
+#include "Op/DepthToSpace.h"
#include "Op/DepthwiseConv2D.h"
+#include "Op/Dequantize.h"
#include "Op/Div.h"
+#include "Op/ELU.h"
+#include "Op/Equal.h"
+#include "Op/Exp.h"
+#include "Op/ExpandDims.h"
+#include "Op/Fill.h"
+#include "Op/Floor.h"
+#include "Op/FloorDiv.h"
+#include "Op/FloorMod.h"
#include "Op/FullyConnected.h"
+#include "Op/Gather.h"
+#include "Op/GatherNd.h"
+#include "Op/Greater.h"
+#include "Op/GreaterEqual.h"
+#include "Op/L2Normalize.h"
+#include "Op/L2Pool2D.h"
+#include "Op/LeakyRelu.h"
+#include "Op/Less.h"
+#include "Op/LessEqual.h"
+#include "Op/LocalResponseNormalization.h"
+#include "Op/Log.h"
+#include "Op/LogicalAnd.h"
+#include "Op/LogicalNot.h"
+#include "Op/LogicalOr.h"
+#include "Op/Logistic.h"
+#include "Op/LogSoftmax.h"
+#include "Op/MatrixDiag.h"
+#include "Op/MatrixSetDiag.h"
+#include "Op/Maximum.h"
#include "Op/MaxPool2D.h"
+#include "Op/Mean.h"
+#include "Op/Minimum.h"
+#include "Op/MirrorPad.h"
+#include "Op/Mul.h"
+#include "Op/Neg.h"
+#include "Op/NonMaxSuppressionV4.h"
+#include "Op/NonMaxSuppressionV5.h"
+#include "Op/NotEqual.h"
+#include "Op/OneHot.h"
+#include "Op/Pack.h"
+#include "Op/Pad.h"
+#include "Op/PadV2.h"
+#include "Op/Pow.h"
+#include "Op/PRelu.h"
+#include "Op/Range.h"
+#include "Op/Rank.h"
+#include "Op/ReduceAny.h"
+#include "Op/ReduceMax.h"
+#include "Op/ReduceMin.h"
+#include "Op/ReduceProd.h"
#include "Op/ReLU.h"
#include "Op/ReLU6.h"
+#include "Op/ReLUN1To1.h"
#include "Op/Reshape.h"
+#include "Op/ResizeBilinear.h"
+#include "Op/ResizeNearestNeighbor.h"
+#include "Op/ReverseSequence.h"
+#include "Op/ReverseV2.h"
+#include "Op/Round.h"
+#include "Op/Rsqrt.h"
+#include "Op/ScatterNd.h"
+#include "Op/SegmentSum.h"
+#include "Op/Select.h"
+#include "Op/SelectV2.h"
+#include "Op/Shape.h"
+#include "Op/Sin.h"
+#include "Op/Slice.h"
+#include "Op/Softmax.h"
+#include "Op/SpaceToBatchND.h"
+#include "Op/SpaceToDepth.h"
+#include "Op/SparseToDense.h"
+#include "Op/Split.h"
+#include "Op/SplitV.h"
#include "Op/Sqrt.h"
+#include "Op/Square.h"
+#include "Op/SquaredDifference.h"
+#include "Op/Squeeze.h"
+#include "Op/StridedSlice.h"
#include "Op/Sub.h"
+#include "Op/Sum.h"
+#include "Op/Tanh.h"
+#include "Op/Tile.h"
+#include "Op/TopKV2.h"
+#include "Op/Transpose.h"
+#include "Op/TransposeConv.h"
+#include "Op/UnidirectionalSequenceLSTM.h"
+#include "Op/Unique.h"
+#include "Op/Unpack.h"
+#include "Op/Where.h"
+#include "Op/ZerosLike.h"
#endif // __TFLITE_OP_CHEFS_H__
diff --git a/compiler/tflchef/tflite/src/TFliteOpRegistry.h b/compiler/tflchef/tflite/src/TFliteOpRegistry.h
index 9e085028c..9cc630a97 100644
--- a/compiler/tflchef/tflite/src/TFliteOpRegistry.h
+++ b/compiler/tflchef/tflite/src/TFliteOpRegistry.h
@@ -20,9 +20,7 @@
#include "TFliteOpChef.h"
#include "TFliteOpChefs.h"
-#include <stdex/Memory.h>
-
-using stdex::make_unique;
+#include <memory>
namespace tflchef
{
@@ -54,19 +52,117 @@ public:
private:
TFliteOpRegistry()
{
- _tfliteop_map[tflite::BuiltinOperator_AVERAGE_POOL_2D] = make_unique<TFliteOpAveragePool2D>();
- _tfliteop_map[tflite::BuiltinOperator_CONCATENATION] = make_unique<TFliteOpConcatenation>();
- _tfliteop_map[tflite::BuiltinOperator_CONV_2D] = make_unique<TFliteOpConv2D>();
- _tfliteop_map[tflite::BuiltinOperator_DEPTHWISE_CONV_2D] =
- make_unique<TFliteOpDepthwiseConv2D>();
- _tfliteop_map[tflite::BuiltinOperator_DIV] = make_unique<TFliteOpDiv>();
- _tfliteop_map[tflite::BuiltinOperator_FULLY_CONNECTED] = make_unique<TFliteOpFullyConnected>();
- _tfliteop_map[tflite::BuiltinOperator_MAX_POOL_2D] = make_unique<TFliteOpMaxPool2D>();
- _tfliteop_map[tflite::BuiltinOperator_RELU] = make_unique<TFliteOpReLU>();
- _tfliteop_map[tflite::BuiltinOperator_RELU6] = make_unique<TFliteOpReLU6>();
- _tfliteop_map[tflite::BuiltinOperator_RESHAPE] = make_unique<TFliteOpReshape>();
- _tfliteop_map[tflite::BuiltinOperator_SQRT] = make_unique<TFliteOpSqrt>();
- _tfliteop_map[tflite::BuiltinOperator_SUB] = make_unique<TFliteOpSub>();
+#define REG_TFL_OP(OPCODE, CLASS) \
+ _tfliteop_map[tflite::BuiltinOperator_##OPCODE] = std::make_unique<CLASS>()
+
+ REG_TFL_OP(ABS, TFliteOpAbs);
+ REG_TFL_OP(ADD, TFliteOpAdd);
+ REG_TFL_OP(ADD_N, TFliteOpAddN);
+ REG_TFL_OP(ARG_MAX, TFliteOpArgMax);
+ REG_TFL_OP(ARG_MIN, TFliteOpArgMin);
+ REG_TFL_OP(AVERAGE_POOL_2D, TFliteOpAveragePool2D);
+ REG_TFL_OP(BATCH_MATMUL, TFliteOpBatchMatMul);
+ REG_TFL_OP(BATCH_TO_SPACE_ND, TFliteOpBatchToSpaceND);
+ REG_TFL_OP(CAST, TFliteOpCast);
+ REG_TFL_OP(CEIL, TFliteOpCeil);
+ REG_TFL_OP(CONCATENATION, TFliteOpConcatenation);
+ REG_TFL_OP(CONV_2D, TFliteOpConv2D);
+ REG_TFL_OP(COS, TFliteOpCos);
+ REG_TFL_OP(DEPTH_TO_SPACE, TFliteOpDepthToSpace);
+ REG_TFL_OP(DEPTHWISE_CONV_2D, TFliteOpDepthwiseConv2D);
+ REG_TFL_OP(DEQUANTIZE, TFliteOpDequantize);
+ REG_TFL_OP(DIV, TFliteOpDiv);
+ REG_TFL_OP(ELU, TFliteOpELU);
+ REG_TFL_OP(EQUAL, TFliteOpEqual);
+ REG_TFL_OP(EXP, TFliteOpExp);
+ REG_TFL_OP(EXPAND_DIMS, TFliteOpExpandDims);
+ REG_TFL_OP(FILL, TFliteOpFill);
+ REG_TFL_OP(FLOOR, TFliteOpFloor);
+ REG_TFL_OP(FLOOR_DIV, TFliteOpFloorDiv);
+ REG_TFL_OP(FLOOR_MOD, TFliteOpFloorMod);
+ REG_TFL_OP(FULLY_CONNECTED, TFliteOpFullyConnected);
+ REG_TFL_OP(GATHER, TFliteOpGather);
+ REG_TFL_OP(GATHER_ND, TFliteOpGatherNd);
+ REG_TFL_OP(GREATER, TFliteOpGreater);
+ REG_TFL_OP(GREATER_EQUAL, TFliteOpGreaterEqual);
+ REG_TFL_OP(L2_NORMALIZATION, TFliteOpL2Normalize);
+ REG_TFL_OP(L2_POOL_2D, TFliteOpL2Pool2D);
+ REG_TFL_OP(LEAKY_RELU, TFliteOpLeakyRelu);
+ REG_TFL_OP(LESS, TFliteOpLess);
+ REG_TFL_OP(LESS_EQUAL, TFliteOpLessEqual);
+ REG_TFL_OP(LOCAL_RESPONSE_NORMALIZATION, TFliteOpLocalResponseNormalization);
+ REG_TFL_OP(LOG, TFliteOpLog);
+ REG_TFL_OP(LOGICAL_AND, TFliteOpLogicalAnd);
+ REG_TFL_OP(LOGICAL_NOT, TFliteOpLogicalNot);
+ REG_TFL_OP(LOGICAL_OR, TFliteOpLogicalOr);
+ REG_TFL_OP(LOGISTIC, TFliteOpLogistic);
+ REG_TFL_OP(LOG_SOFTMAX, TFliteOpLogSoftmax);
+ REG_TFL_OP(MATRIX_DIAG, TFliteOpMatrixDiag);
+ REG_TFL_OP(MAX_POOL_2D, TFliteOpMaxPool2D);
+ REG_TFL_OP(MATRIX_SET_DIAG, TFliteOpMatrixSetDiag);
+ REG_TFL_OP(MAXIMUM, TFliteOpMaximum);
+ REG_TFL_OP(MEAN, TFliteOpMean);
+ REG_TFL_OP(MINIMUM, TFliteOpMinimum);
+ REG_TFL_OP(MIRROR_PAD, TFliteOpMirrorPad);
+ REG_TFL_OP(MUL, TFliteOpMul);
+ REG_TFL_OP(NEG, TFliteOpNeg);
+ REG_TFL_OP(NON_MAX_SUPPRESSION_V4, TFliteOpNonMaxSuppressionV4);
+ REG_TFL_OP(NON_MAX_SUPPRESSION_V5, TFliteOpNonMaxSuppressionV5);
+ REG_TFL_OP(NOT_EQUAL, TFliteOpNotEqual);
+ REG_TFL_OP(ONE_HOT, TFliteOpOneHot);
+ REG_TFL_OP(PACK, TFliteOpPack);
+ REG_TFL_OP(PAD, TFliteOpPad);
+ REG_TFL_OP(PADV2, TFliteOpPadV2);
+ REG_TFL_OP(POW, TFliteOpPow);
+ REG_TFL_OP(PRELU, TFliteOpPRelu);
+ REG_TFL_OP(RANGE, TFliteOpRange);
+ REG_TFL_OP(RANK, TFliteOpRank);
+ REG_TFL_OP(REDUCE_ANY, TFliteOpReduceAny);
+ REG_TFL_OP(REDUCE_MAX, TFliteOpReduceMax);
+ REG_TFL_OP(REDUCE_MIN, TFliteOpReduceMin);
+ REG_TFL_OP(REDUCE_PROD, TFliteOpReduceProd);
+ REG_TFL_OP(RELU, TFliteOpReLU);
+ REG_TFL_OP(RELU6, TFliteOpReLU6);
+ REG_TFL_OP(RELU_N1_TO_1, TFliteOpReLUN1To1);
+ REG_TFL_OP(RESHAPE, TFliteOpReshape);
+ REG_TFL_OP(RESIZE_BILINEAR, TFliteOpResizeBilinear);
+ REG_TFL_OP(RESIZE_NEAREST_NEIGHBOR, TFliteOpResizeNearestNeighbor);
+ REG_TFL_OP(REVERSE_SEQUENCE, TFliteOpReverseSequence);
+ REG_TFL_OP(REVERSE_V2, TFliteOpReverseV2);
+ REG_TFL_OP(ROUND, TFliteOpRound);
+ REG_TFL_OP(RSQRT, TFliteOpRsqrt);
+ REG_TFL_OP(SCATTER_ND, TFliteOpScatterNd);
+ REG_TFL_OP(SEGMENT_SUM, TFliteOpSegmentSum);
+ REG_TFL_OP(SELECT, TFliteOpSelect);
+ REG_TFL_OP(SELECT_V2, TFliteOpSelectV2);
+ REG_TFL_OP(SHAPE, TFliteOpShape);
+ REG_TFL_OP(SIN, TFliteOpSin);
+ REG_TFL_OP(SLICE, TFliteOpSlice);
+ REG_TFL_OP(SOFTMAX, TFliteOpSoftmax);
+ REG_TFL_OP(SPACE_TO_BATCH_ND, TFliteOpSpaceToBatchND);
+ REG_TFL_OP(SPACE_TO_DEPTH, TFliteOpSpaceToDepth);
+ REG_TFL_OP(SPARSE_TO_DENSE, TFliteOpSparseToDense);
+ REG_TFL_OP(SPLIT, TFliteOpSplit);
+ REG_TFL_OP(SPLIT_V, TFliteOpSplitV);
+ REG_TFL_OP(SQRT, TFliteOpSqrt);
+ REG_TFL_OP(SQUARE, TFliteOpSquare);
+ REG_TFL_OP(SQUARED_DIFFERENCE, TFliteOpSquaredDifference);
+ REG_TFL_OP(SQUEEZE, TFliteOpSqueeze);
+ REG_TFL_OP(STRIDED_SLICE, TFliteOpStridedSlice);
+ REG_TFL_OP(SUB, TFliteOpSub);
+ REG_TFL_OP(SUM, TFliteOpSum);
+ REG_TFL_OP(TANH, TFliteOpTanh);
+ REG_TFL_OP(TILE, TFliteOpTile);
+ REG_TFL_OP(TOPK_V2, TFliteOpTopKV2);
+ REG_TFL_OP(TRANSPOSE, TFliteOpTranspose);
+ REG_TFL_OP(TRANSPOSE_CONV, TFliteOpTransposeConv);
+ REG_TFL_OP(UNIDIRECTIONAL_SEQUENCE_LSTM, TFliteOpUnidirectionalSequenceLSTM);
+ REG_TFL_OP(UNIQUE, TFliteOpUnique);
+ REG_TFL_OP(UNPACK, TFliteOpUnpack);
+ REG_TFL_OP(WHERE, TFliteOpWhere);
+ REG_TFL_OP(ZEROS_LIKE, TFliteOpZerosLike);
+
+#undef REG_TFL_OP
}
private: