diff options
Diffstat (limited to 'compiler/tflchef/tflite')
-rw-r--r-- | compiler/tflchef/tflite/CMakeLists.txt | 5 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Convert.cpp | 45 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Convert.h | 2 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/FillerHelper.cpp | 15 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/FillerHelper.h | 8 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/Add.cpp | 6 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/BidirectionalSequenceLSTM.cpp | 67 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/Dequantize.cpp | 40 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/FakeQuant.cpp | 50 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/FullyConnected.cpp | 11 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/Gelu.cpp | 46 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/HardSwish.cpp | 40 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/Maximum.cpp | 5 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/Minimum.cpp | 3 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/Mul.cpp | 6 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/NonMaxSuppressionV4.cpp | 2 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/NonMaxSuppressionV5.cpp | 2 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/PRelu.cpp | 5 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/PadV2.cpp | 7 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/Quantize.cpp | 40 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/SVDF.cpp | 59 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/ScatterNd.cpp | 6 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/SegmentSum.cpp | 7 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/Sub.cpp | 6 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/TransposeConv.cpp | 2 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/UnidirectionalSequenceLSTM.cpp | 66 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Abs.h (renamed from compiler/tflchef/tflite/src/Op/Abs.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Add.h (renamed from compiler/tflchef/tflite/src/Op/Add.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/AddN.h (renamed from compiler/tflchef/tflite/src/Op/AddN.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/ArgMax.h (renamed from compiler/tflchef/tflite/src/Op/ArgMax.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/ArgMin.h (renamed from compiler/tflchef/tflite/src/Op/ArgMin.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/AveragePool2D.h (renamed from compiler/tflchef/tflite/src/Op/AveragePool2D.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/BatchMatMul.h (renamed from compiler/tflchef/tflite/src/Op/BatchMatMul.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/BatchToSpaceND.h (renamed from compiler/tflchef/tflite/src/Op/BatchToSpaceND.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/BidirectionalSequenceLSTM.h | 39 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Cast.h (renamed from compiler/tflchef/tflite/src/Op/Cast.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Ceil.h (renamed from compiler/tflchef/tflite/src/Op/Ceil.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Concatenation.h (renamed from compiler/tflchef/tflite/src/Op/Concatenation.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Conv2D.h (renamed from compiler/tflchef/tflite/src/Op/Conv2D.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Cos.h (renamed from compiler/tflchef/tflite/src/Op/Cos.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/DepthToSpace.h (renamed from compiler/tflchef/tflite/src/Op/DepthToSpace.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/DepthwiseConv2D.h (renamed from compiler/tflchef/tflite/src/Op/DepthwiseConv2D.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Dequantize.h | 39 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Div.h (renamed from compiler/tflchef/tflite/src/Op/Div.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/ELU.h (renamed from compiler/tflchef/tflite/src/Op/ELU.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Equal.h (renamed from compiler/tflchef/tflite/src/Op/Equal.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Exp.h (renamed from compiler/tflchef/tflite/src/Op/Exp.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/ExpandDims.h (renamed from compiler/tflchef/tflite/src/Op/ExpandDims.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/FakeQuant.h | 39 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Fill.h (renamed from compiler/tflchef/tflite/src/Op/Fill.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Floor.h (renamed from compiler/tflchef/tflite/src/Op/Floor.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/FloorDiv.h (renamed from compiler/tflchef/tflite/src/Op/FloorDiv.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/FloorMod.h (renamed from compiler/tflchef/tflite/src/Op/FloorMod.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/FullyConnected.h (renamed from compiler/tflchef/tflite/src/Op/FullyConnected.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Gather.h (renamed from compiler/tflchef/tflite/src/Op/Gather.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/GatherNd.h (renamed from compiler/tflchef/tflite/src/Op/GatherNd.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Gelu.h | 39 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Greater.h (renamed from compiler/tflchef/tflite/src/Op/Greater.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/GreaterEqual.h (renamed from compiler/tflchef/tflite/src/Op/GreaterEqual.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/HardSwish.h | 39 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/L2Normalize.h (renamed from compiler/tflchef/tflite/src/Op/L2Normalize.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/L2Pool2D.h (renamed from compiler/tflchef/tflite/src/Op/L2Pool2D.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/LeakyRelu.h (renamed from compiler/tflchef/tflite/src/Op/LeakyRelu.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Less.h (renamed from compiler/tflchef/tflite/src/Op/Less.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/LessEqual.h (renamed from compiler/tflchef/tflite/src/Op/LessEqual.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/LocalResponseNormalization.h (renamed from compiler/tflchef/tflite/src/Op/LocalResponseNormalization.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Log.h (renamed from compiler/tflchef/tflite/src/Op/Log.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/LogSoftmax.h (renamed from compiler/tflchef/tflite/src/Op/LogSoftmax.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/LogicalAnd.h (renamed from compiler/tflchef/tflite/src/Op/LogicalAnd.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/LogicalNot.h (renamed from compiler/tflchef/tflite/src/Op/LogicalNot.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/LogicalOr.h (renamed from compiler/tflchef/tflite/src/Op/LogicalOr.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Logistic.h (renamed from compiler/tflchef/tflite/src/Op/Logistic.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/MatrixDiag.h (renamed from compiler/tflchef/tflite/src/Op/MatrixDiag.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/MatrixSetDiag.h (renamed from compiler/tflchef/tflite/src/Op/MatrixSetDiag.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/MaxPool2D.h (renamed from compiler/tflchef/tflite/src/Op/MaxPool2D.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Maximum.h (renamed from compiler/tflchef/tflite/src/Op/Maximum.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Mean.h (renamed from compiler/tflchef/tflite/src/Op/Mean.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Minimum.h (renamed from compiler/tflchef/tflite/src/Op/Minimum.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/MirrorPad.h (renamed from compiler/tflchef/tflite/src/Op/MirrorPad.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Mul.h (renamed from compiler/tflchef/tflite/src/Op/Mul.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Neg.h (renamed from compiler/tflchef/tflite/src/Op/Neg.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/NonMaxSuppressionV4.h (renamed from compiler/tflchef/tflite/src/Op/NonMaxSuppressionV4.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/NonMaxSuppressionV5.h (renamed from compiler/tflchef/tflite/src/Op/NonMaxSuppressionV5.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/NotEqual.h (renamed from compiler/tflchef/tflite/src/Op/NotEqual.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/OneHot.h (renamed from compiler/tflchef/tflite/src/Op/OneHot.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/PRelu.h (renamed from compiler/tflchef/tflite/src/Op/PRelu.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Pack.h (renamed from compiler/tflchef/tflite/src/Op/Pack.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Pad.h (renamed from compiler/tflchef/tflite/src/Op/Pad.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/PadV2.h (renamed from compiler/tflchef/tflite/src/Op/PadV2.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Pow.h (renamed from compiler/tflchef/tflite/src/Op/Pow.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Quantize.h | 39 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Range.h (renamed from compiler/tflchef/tflite/src/Op/Range.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Rank.h (renamed from compiler/tflchef/tflite/src/Op/Rank.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/ReLU.h (renamed from compiler/tflchef/tflite/src/Op/ReLU.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/ReLU6.h (renamed from compiler/tflchef/tflite/src/Op/ReLU6.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/ReLUN1To1.h (renamed from compiler/tflchef/tflite/src/Op/ReLUN1To1.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/ReduceAny.h (renamed from compiler/tflchef/tflite/src/Op/ReduceAny.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/ReduceMax.h (renamed from compiler/tflchef/tflite/src/Op/ReduceMax.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/ReduceMin.h (renamed from compiler/tflchef/tflite/src/Op/ReduceMin.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/ReduceProd.h (renamed from compiler/tflchef/tflite/src/Op/ReduceProd.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Reshape.h (renamed from compiler/tflchef/tflite/src/Op/Reshape.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/ResizeBilinear.h (renamed from compiler/tflchef/tflite/src/Op/ResizeBilinear.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/ResizeNearestNeighbor.h (renamed from compiler/tflchef/tflite/src/Op/ResizeNearestNeighbor.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/ReverseSequence.h (renamed from compiler/tflchef/tflite/src/Op/ReverseSequence.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/ReverseV2.h (renamed from compiler/tflchef/tflite/src/Op/ReverseV2.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Round.h (renamed from compiler/tflchef/tflite/src/Op/Round.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Rsqrt.h (renamed from compiler/tflchef/tflite/src/Op/Rsqrt.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/SVDF.h | 39 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/ScatterNd.h (renamed from compiler/tflchef/tflite/src/Op/ScatterNd.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/SegmentSum.h (renamed from compiler/tflchef/tflite/src/Op/SegmentSum.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Select.h (renamed from compiler/tflchef/tflite/src/Op/Select.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/SelectV2.h (renamed from compiler/tflchef/tflite/src/Op/SelectV2.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Shape.h (renamed from compiler/tflchef/tflite/src/Op/Shape.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Sin.h (renamed from compiler/tflchef/tflite/src/Op/Sin.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Slice.h (renamed from compiler/tflchef/tflite/src/Op/Slice.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Softmax.h (renamed from compiler/tflchef/tflite/src/Op/Softmax.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/SpaceToBatchND.h (renamed from compiler/tflchef/tflite/src/Op/SpaceToBatchND.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/SpaceToDepth.h (renamed from compiler/tflchef/tflite/src/Op/SpaceToDepth.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/SparseToDense.h (renamed from compiler/tflchef/tflite/src/Op/SparseToDense.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Split.h (renamed from compiler/tflchef/tflite/src/Op/Split.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/SplitV.h (renamed from compiler/tflchef/tflite/src/Op/SplitV.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Sqrt.h (renamed from compiler/tflchef/tflite/src/Op/Sqrt.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Square.h (renamed from compiler/tflchef/tflite/src/Op/Square.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/SquaredDifference.h (renamed from compiler/tflchef/tflite/src/Op/SquaredDifference.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Squeeze.h (renamed from compiler/tflchef/tflite/src/Op/Squeeze.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/StridedSlice.h (renamed from compiler/tflchef/tflite/src/Op/StridedSlice.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Sub.h (renamed from compiler/tflchef/tflite/src/Op/Sub.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Sum.h (renamed from compiler/tflchef/tflite/src/Op/Sum.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Tanh.h (renamed from compiler/tflchef/tflite/src/Op/Tanh.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Tile.h (renamed from compiler/tflchef/tflite/src/Op/Tile.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/TopKV2.h (renamed from compiler/tflchef/tflite/src/Op/TopKV2.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Transpose.h (renamed from compiler/tflchef/tflite/src/Op/Transpose.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/TransposeConv.h (renamed from compiler/tflchef/tflite/src/Op/TransposeConv.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/UnidirectionalSequenceLSTM.h | 39 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Unique.h (renamed from compiler/tflchef/tflite/src/Op/Unique.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Unpack.h (renamed from compiler/tflchef/tflite/src/Op/Unpack.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/Where.h (renamed from compiler/tflchef/tflite/src/Op/Where.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/Op/include/ZerosLike.h (renamed from compiler/tflchef/tflite/src/Op/ZerosLike.h) | 0 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/RecipeChef.cpp | 105 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/TFliteImport.cpp | 37 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/TFliteImport.h | 5 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/TFliteOpChefs.h | 216 | ||||
-rw-r--r-- | compiler/tflchef/tflite/src/TFliteOpRegistry.h | 8 |
143 files changed, 1056 insertions, 178 deletions
diff --git a/compiler/tflchef/tflite/CMakeLists.txt b/compiler/tflchef/tflite/CMakeLists.txt index 83127cb3e..bf20f31c2 100644 --- a/compiler/tflchef/tflite/CMakeLists.txt +++ b/compiler/tflchef/tflite/CMakeLists.txt @@ -3,8 +3,9 @@ file(GLOB_RECURSE SOURCES "src/*.cpp") add_library(tflchef_tflite STATIC ${SOURCES}) target_include_directories(tflchef_tflite PUBLIC include) target_include_directories(tflchef_tflite PRIVATE src) +target_include_directories(tflchef_tflite PRIVATE src/Op/include) target_link_libraries(tflchef_tflite tflchef_proto) -target_link_libraries(tflchef_tflite mio_tflite) -target_link_libraries(tflchef_tflite stdex) +target_link_libraries(tflchef_tflite mio_tflite2121) +target_link_libraries(tflchef_tflite mio_tflite2121_helper) target_link_libraries(tflchef_tflite cwrap) target_link_libraries(tflchef_tflite souschef) diff --git a/compiler/tflchef/tflite/src/Convert.cpp b/compiler/tflchef/tflite/src/Convert.cpp index 3cc1c9238..46812f4d6 100644 --- a/compiler/tflchef/tflite/src/Convert.cpp +++ b/compiler/tflchef/tflite/src/Convert.cpp @@ -33,10 +33,14 @@ tflchef::TensorType as_tflchef_type(const tflite::TensorType type) return tflchef::UINT8; case tflite::TensorType_BOOL: return tflchef::BOOL; + case tflite::TensorType_INT8: + return tflchef::INT8; + case tflite::TensorType_INT16: + return tflchef::INT16; + case tflite::TensorType_FLOAT16: + return tflchef::FLOAT16; // TODO handle other types - // TensorType_FLOAT16 // TensorType_STRING - // TensorType_INT16 // TensorType_COMPLEX64 default: throw std::runtime_error{"unsupported tensor type"}; @@ -55,9 +59,10 @@ tflchef::Activation as_tflchef_activation(const tflite::ActivationFunctionType t return tflchef::RELU_N1_TO_1; case tflite::ActivationFunctionType_RELU6: return tflchef::RELU6; - // TODO handle other types - // 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"}; } @@ -89,4 +94,34 @@ tflchef::MirrorPadMode as_tflchef_mirrorpadmode(const tflite::MirrorPadMode 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 770bffa4d..cf0c61550 100644 --- a/compiler/tflchef/tflite/src/Convert.h +++ b/compiler/tflchef/tflite/src/Convert.h @@ -28,6 +28,8 @@ 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> diff --git a/compiler/tflchef/tflite/src/FillerHelper.cpp b/compiler/tflchef/tflite/src/FillerHelper.cpp index cf96d2e8c..1ac99ad40 100644 --- a/compiler/tflchef/tflite/src/FillerHelper.cpp +++ b/compiler/tflchef/tflite/src/FillerHelper.cpp @@ -48,3 +48,18 @@ void fill_tensor_to_import(int32_t idx, TFliteImport *import) } } // namespace tflchef + +// helpers of common codes for filling inputs +namespace tflchef +{ + +void fill_two_inputs(const tflite::Operator *op, TFliteImport *import) +{ + 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); +} + +} // namespace tflchef diff --git a/compiler/tflchef/tflite/src/FillerHelper.h b/compiler/tflchef/tflite/src/FillerHelper.h index 053a5c18a..e96ae73d0 100644 --- a/compiler/tflchef/tflite/src/FillerHelper.h +++ b/compiler/tflchef/tflite/src/FillerHelper.h @@ -28,4 +28,12 @@ void fill_tensor_to_import(int32_t idx, TFliteImport *import); } // namespace tflchef +// helpers of common codes for filling inputs +namespace tflchef +{ + +void fill_two_inputs(const tflite::Operator *op, TFliteImport *import); + +} // namespace tflchef + #endif // __FILLER_HELPER_H__ diff --git a/compiler/tflchef/tflite/src/Op/Add.cpp b/compiler/tflchef/tflite/src/Op/Add.cpp index 3e880a63b..23d360616 100644 --- a/compiler/tflchef/tflite/src/Op/Add.cpp +++ b/compiler/tflchef/tflite/src/Op/Add.cpp @@ -27,11 +27,7 @@ void TFliteOpAdd::filler(const tflite::Operator *op, TFliteImport *import, { // 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); + fill_two_inputs(op, import); } tflchef::Operation *TFliteOpAdd::build(const tflite::Operator *op, TFliteImport *import, diff --git a/compiler/tflchef/tflite/src/Op/BidirectionalSequenceLSTM.cpp b/compiler/tflchef/tflite/src/Op/BidirectionalSequenceLSTM.cpp new file mode 100644 index 000000000..32548247e --- /dev/null +++ b/compiler/tflchef/tflite/src/Op/BidirectionalSequenceLSTM.cpp @@ -0,0 +1,67 @@ +/* + * 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 "BidirectionalSequenceLSTM.h" + +#include "Convert.h" +#include "FillerHelper.h" + +namespace tflchef +{ + +void TFliteOpBidirectionalSequenceLSTM::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() == 48); + + for (int32_t i = 0; i < inputs.size(); i++) + { + // Except for Input 0, 35, 36, 37 and 38. + // Each Input mean Input Tensor, ActivationState Tensor (forward and backward), and CellState + // Tensor (forward and backward). + // This could be updated from previous input or User Given data, so This could not be Const + if (i == 0 || i == 35 || i == 36 || i == 37 || i == 38) + continue; + if (inputs[i] != -1) + fill_tensor_to_import(inputs[i], import); + } +} + +tflchef::Operation * +TFliteOpBidirectionalSequenceLSTM::build(const tflite::Operator *op, TFliteImport *import, + tflchef::ModelRecipe *model_recipe) const +{ + auto op_params = op->builtin_options_as_BidirectionalSequenceLSTMOptions(); + assert(op_params != nullptr); + + auto operation = model_recipe->add_operation(); + + operation->set_type("BidirectionalSequenceLSTM"); + + auto op_options = operation->mutable_bidirectional_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()); + op_options->set_merge_outputs(op_params->merge_outputs()); + + return operation; +} + +} // namespace tflchef 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/FakeQuant.cpp b/compiler/tflchef/tflite/src/Op/FakeQuant.cpp new file mode 100644 index 000000000..f44b85465 --- /dev/null +++ b/compiler/tflchef/tflite/src/Op/FakeQuant.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2021 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 "FakeQuant.h" + +#include "Convert.h" + +namespace tflchef +{ + +void TFliteOpFakeQuant::filler(const tflite::Operator *op, TFliteImport *import, + tflchef::ModelRecipe *model_recipe) const +{ + // Nothing to do with filler +} + +tflchef::Operation *TFliteOpFakeQuant::build(const tflite::Operator *op, TFliteImport *import, + tflchef::ModelRecipe *model_recipe) const +{ + auto op_params = op->builtin_options_as_FakeQuantOptions(); + assert(op_params != nullptr); + + auto operation = model_recipe->add_operation(); + + operation->set_type("FakeQuant"); + + auto op_options = operation->mutable_fakequant_options(); + + op_options->set_min(op_params->min()); + op_options->set_max(op_params->max()); + op_options->set_num_bits(op_params->num_bits()); + op_options->set_narrow_range(op_params->narrow_range()); + + return operation; +} + +} // namespace tflchef diff --git a/compiler/tflchef/tflite/src/Op/FullyConnected.cpp b/compiler/tflchef/tflite/src/Op/FullyConnected.cpp index 4291c844b..bbc749fe4 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, @@ -40,6 +48,7 @@ tflchef::Operation *TFliteOpFullyConnected::build(const tflite::Operator *op, TF auto op_options = operation->mutable_fullyconnected_options(); op_options->set_activation(as_tflchef_activation(op_params->fused_activation_function())); + op_options->set_keep_num_dims(op_params->keep_num_dims()); return operation; } diff --git a/compiler/tflchef/tflite/src/Op/Gelu.cpp b/compiler/tflchef/tflite/src/Op/Gelu.cpp new file mode 100644 index 000000000..23cee07b0 --- /dev/null +++ b/compiler/tflchef/tflite/src/Op/Gelu.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2023 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 "Gelu.h" + +#include "Convert.h" + +namespace tflchef +{ + +void TFliteOpGelu::filler(const tflite::Operator *op, TFliteImport *import, + tflchef::ModelRecipe *model_recipe) const +{ + // Nothing to do with filler +} + +tflchef::Operation *TFliteOpGelu::build(const tflite::Operator *op, TFliteImport *import, + tflchef::ModelRecipe *model_recipe) const +{ + auto op_params = op->builtin_options_as_GeluOptions(); + + auto operation = model_recipe->add_operation(); + + operation->set_type("Gelu"); + + auto *op_options = operation->mutable_gelu_options(); + + op_options->set_approximate(op_params->approximate()); + + return operation; +} + +} // namespace tflchef diff --git a/compiler/tflchef/tflite/src/Op/HardSwish.cpp b/compiler/tflchef/tflite/src/Op/HardSwish.cpp new file mode 100644 index 000000000..2282ff97d --- /dev/null +++ b/compiler/tflchef/tflite/src/Op/HardSwish.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2023 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 "HardSwish.h" + +#include "Convert.h" + +namespace tflchef +{ + +void TFliteOpHardSwish::filler(const tflite::Operator *op, TFliteImport *import, + tflchef::ModelRecipe *model_recipe) const +{ + // Nothing to do with filler +} + +tflchef::Operation *TFliteOpHardSwish::build(const tflite::Operator *op, TFliteImport *import, + tflchef::ModelRecipe *model_recipe) const +{ + auto operation = model_recipe->add_operation(); + + operation->set_type("HardSwish"); + + return operation; +} + +} // namespace tflchef diff --git a/compiler/tflchef/tflite/src/Op/Maximum.cpp b/compiler/tflchef/tflite/src/Op/Maximum.cpp index fb977b6ed..65e4c2c99 100644 --- a/compiler/tflchef/tflite/src/Op/Maximum.cpp +++ b/compiler/tflchef/tflite/src/Op/Maximum.cpp @@ -16,13 +16,16 @@ #include "Maximum.h" +#include "Convert.h" +#include "FillerHelper.h" + namespace tflchef { void TFliteOpMaximum::filler(const tflite::Operator *op, TFliteImport *import, tflchef::ModelRecipe *model_recipe) const { - // Nothing to do with filler + fill_two_inputs(op, import); } tflchef::Operation *TFliteOpMaximum::build(const tflite::Operator *op, TFliteImport *import, diff --git a/compiler/tflchef/tflite/src/Op/Minimum.cpp b/compiler/tflchef/tflite/src/Op/Minimum.cpp index 2bb50cb89..b4d255ce3 100644 --- a/compiler/tflchef/tflite/src/Op/Minimum.cpp +++ b/compiler/tflchef/tflite/src/Op/Minimum.cpp @@ -17,6 +17,7 @@ #include "Minimum.h" #include "Convert.h" +#include "FillerHelper.h" namespace tflchef { @@ -24,7 +25,7 @@ namespace tflchef void TFliteOpMinimum::filler(const tflite::Operator *op, TFliteImport *import, tflchef::ModelRecipe *model_recipe) const { - // Nothing to do with filler + fill_two_inputs(op, import); } tflchef::Operation *TFliteOpMinimum::build(const tflite::Operator *op, TFliteImport *import, diff --git a/compiler/tflchef/tflite/src/Op/Mul.cpp b/compiler/tflchef/tflite/src/Op/Mul.cpp index 9faa4acaf..1145ff7e6 100644 --- a/compiler/tflchef/tflite/src/Op/Mul.cpp +++ b/compiler/tflchef/tflite/src/Op/Mul.cpp @@ -27,11 +27,7 @@ void TFliteOpMul::filler(const tflite::Operator *op, TFliteImport *import, { // 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); + fill_two_inputs(op, import); } tflchef::Operation *TFliteOpMul::build(const tflite::Operator *op, TFliteImport *import, diff --git a/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV4.cpp b/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV4.cpp index ad9921970..4f096ced4 100644 --- a/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV4.cpp +++ b/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV4.cpp @@ -38,7 +38,7 @@ void TFliteOpNonMaxSuppressionV4::filler(const tflite::Operator *op, TFliteImpor for (int32_t index = 2; index < 5; ++index) { - fill_tensor_to_import(index, import); + fill_tensor_to_import(inputs[index], import); } } diff --git a/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV5.cpp b/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV5.cpp index db7f4c932..332cba0ff 100644 --- a/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV5.cpp +++ b/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV5.cpp @@ -41,7 +41,7 @@ void TFliteOpNonMaxSuppressionV5::filler(const tflite::Operator *op, TFliteImpor for (int32_t index = 2; index < 6; ++index) { - fill_tensor_to_import(index, import); + fill_tensor_to_import(inputs[index], import); } } diff --git a/compiler/tflchef/tflite/src/Op/PRelu.cpp b/compiler/tflchef/tflite/src/Op/PRelu.cpp index 8a5e83a84..1a1a84bce 100644 --- a/compiler/tflchef/tflite/src/Op/PRelu.cpp +++ b/compiler/tflchef/tflite/src/Op/PRelu.cpp @@ -24,6 +24,11 @@ namespace tflchef void TFliteOpPRelu::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() == 2); + + import->set_tensor_filler(inputs.at(1)); // alpha } tflchef::Operation *TFliteOpPRelu::build(const tflite::Operator *op, TFliteImport *import, diff --git a/compiler/tflchef/tflite/src/Op/PadV2.cpp b/compiler/tflchef/tflite/src/Op/PadV2.cpp index 0b1c9f3b2..a6b657f59 100644 --- a/compiler/tflchef/tflite/src/Op/PadV2.cpp +++ b/compiler/tflchef/tflite/src/Op/PadV2.cpp @@ -16,6 +16,7 @@ #include "PadV2.h" +#include "Convert.h" #include "FillerHelper.h" namespace tflchef @@ -24,9 +25,11 @@ namespace tflchef void TFliteOpPadV2::filler(const tflite::Operator *op, TFliteImport *import, tflchef::ModelRecipe *model_recipe) const { + const std::vector<int32_t> &inputs = as_index_vector(op->inputs()); + // Filler for paddings and constant_values - fill_tensor_to_import(1, import); - fill_tensor_to_import(2, import); + fill_tensor_to_import(inputs[1], import); + fill_tensor_to_import(inputs[2], import); } tflchef::Operation *TFliteOpPadV2::build(const tflite::Operator *op, TFliteImport *import, diff --git a/compiler/tflchef/tflite/src/Op/Quantize.cpp b/compiler/tflchef/tflite/src/Op/Quantize.cpp new file mode 100644 index 000000000..0808b9c3f --- /dev/null +++ b/compiler/tflchef/tflite/src/Op/Quantize.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2021 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 "Quantize.h" + +#include "Convert.h" + +namespace tflchef +{ + +void TFliteOpQuantize::filler(const tflite::Operator *op, TFliteImport *import, + tflchef::ModelRecipe *model_recipe) const +{ + // Nothing to do with filler +} + +tflchef::Operation *TFliteOpQuantize::build(const tflite::Operator *, TFliteImport *import, + tflchef::ModelRecipe *model_recipe) const +{ + auto operation = model_recipe->add_operation(); + + operation->set_type("Quantize"); + + return operation; +} + +} // namespace tflchef diff --git a/compiler/tflchef/tflite/src/Op/SVDF.cpp b/compiler/tflchef/tflite/src/Op/SVDF.cpp new file mode 100644 index 000000000..015f968a8 --- /dev/null +++ b/compiler/tflchef/tflite/src/Op/SVDF.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 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 "SVDF.h" + +#include "Convert.h" + +namespace tflchef +{ + +void TFliteOpSVDF::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() == 5); + + // optional input tensor idx has minus value. + const bool hasBias = (inputs.at(3) >= 0); + + // Note: last input is variable tensor without data + import->set_tensor_filler(inputs.at(1)); + import->set_tensor_filler(inputs.at(2)); + if (hasBias) + import->set_tensor_filler(inputs.at(3)); +} + +tflchef::Operation *TFliteOpSVDF::build(const tflite::Operator *op, TFliteImport *import, + tflchef::ModelRecipe *model_recipe) const +{ + const auto op_params = op->builtin_options_as_SVDFOptions(); + assert(op_params != nullptr); + + auto operation = model_recipe->add_operation(); + + operation->set_type("SVDF"); + + auto op_options = operation->mutable_svdf_options(); + + op_options->set_activation(as_tflchef_activation(op_params->fused_activation_function())); + op_options->set_asymmetric_quantize_inputs(op_params->asymmetric_quantize_inputs()); + op_options->set_rank(op_params->rank()); + + return operation; +} + +} // namespace tflchef diff --git a/compiler/tflchef/tflite/src/Op/ScatterNd.cpp b/compiler/tflchef/tflite/src/Op/ScatterNd.cpp index 548a09a67..ec09a69a4 100644 --- a/compiler/tflchef/tflite/src/Op/ScatterNd.cpp +++ b/compiler/tflchef/tflite/src/Op/ScatterNd.cpp @@ -25,9 +25,11 @@ namespace tflchef void TFliteOpScatterNd::filler(const tflite::Operator *op, TFliteImport *import, tflchef::ModelRecipe *model_recipe) const { + const std::vector<int32_t> &inputs = as_index_vector(op->inputs()); + // Filler for indices and shape - fill_tensor_to_import(0, import); - fill_tensor_to_import(2, import); + fill_tensor_to_import(inputs[0], import); + fill_tensor_to_import(inputs[2], import); } tflchef::Operation *TFliteOpScatterNd::build(const tflite::Operator *, TFliteImport *, diff --git a/compiler/tflchef/tflite/src/Op/SegmentSum.cpp b/compiler/tflchef/tflite/src/Op/SegmentSum.cpp index a975ca4b3..bc45a94e0 100644 --- a/compiler/tflchef/tflite/src/Op/SegmentSum.cpp +++ b/compiler/tflchef/tflite/src/Op/SegmentSum.cpp @@ -16,6 +16,7 @@ #include "SegmentSum.h" +#include "Convert.h" #include "FillerHelper.h" namespace tflchef @@ -24,8 +25,10 @@ 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); + const std::vector<int32_t> &inputs = as_index_vector(op->inputs()); + + // Filler for segment_ids + fill_tensor_to_import(inputs[1], import); } tflchef::Operation *TFliteOpSegmentSum::build(const tflite::Operator *op, TFliteImport *import, diff --git a/compiler/tflchef/tflite/src/Op/Sub.cpp b/compiler/tflchef/tflite/src/Op/Sub.cpp index 0a08bbfdf..584be0ab9 100644 --- a/compiler/tflchef/tflite/src/Op/Sub.cpp +++ b/compiler/tflchef/tflite/src/Op/Sub.cpp @@ -27,11 +27,7 @@ void TFliteOpSub::filler(const tflite::Operator *op, TFliteImport *import, { // 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); + fill_two_inputs(op, import); } tflchef::Operation *TFliteOpSub::build(const tflite::Operator *op, TFliteImport *import, diff --git a/compiler/tflchef/tflite/src/Op/TransposeConv.cpp b/compiler/tflchef/tflite/src/Op/TransposeConv.cpp index 4e7adf6c6..875ccb51b 100644 --- a/compiler/tflchef/tflite/src/Op/TransposeConv.cpp +++ b/compiler/tflchef/tflite/src/Op/TransposeConv.cpp @@ -53,10 +53,12 @@ tflchef::Operation *TFliteOpTransposeConv::build(const tflite::Operator *op, TFl operation->set_type("TransposeConv"); auto op_options = operation->mutable_transpose_conv_options(); + auto tflchef_activation = as_tflchef_activation(op_params->fused_activation_function()); 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())); + op_options->set_activation(tflchef_activation); return operation; } diff --git a/compiler/tflchef/tflite/src/Op/UnidirectionalSequenceLSTM.cpp b/compiler/tflchef/tflite/src/Op/UnidirectionalSequenceLSTM.cpp new file mode 100644 index 000000000..b2bc1acbd --- /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, 18 and 19. + // Each Input mean Input[0](=Input Tensor), Input[18](=OutputState Tensor) and + // Input[19](=CellState Tensor). + // This could be updated from previous input or User Given data, so This could not be Const + if (i == 0 || i == 18 || i == 19) + 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/Abs.h b/compiler/tflchef/tflite/src/Op/include/Abs.h index d99b0d593..d99b0d593 100644 --- a/compiler/tflchef/tflite/src/Op/Abs.h +++ b/compiler/tflchef/tflite/src/Op/include/Abs.h diff --git a/compiler/tflchef/tflite/src/Op/Add.h b/compiler/tflchef/tflite/src/Op/include/Add.h index 49d945f8b..49d945f8b 100644 --- a/compiler/tflchef/tflite/src/Op/Add.h +++ b/compiler/tflchef/tflite/src/Op/include/Add.h diff --git a/compiler/tflchef/tflite/src/Op/AddN.h b/compiler/tflchef/tflite/src/Op/include/AddN.h index 4387aa06a..4387aa06a 100644 --- a/compiler/tflchef/tflite/src/Op/AddN.h +++ b/compiler/tflchef/tflite/src/Op/include/AddN.h diff --git a/compiler/tflchef/tflite/src/Op/ArgMax.h b/compiler/tflchef/tflite/src/Op/include/ArgMax.h index 30068ecf2..30068ecf2 100644 --- a/compiler/tflchef/tflite/src/Op/ArgMax.h +++ b/compiler/tflchef/tflite/src/Op/include/ArgMax.h diff --git a/compiler/tflchef/tflite/src/Op/ArgMin.h b/compiler/tflchef/tflite/src/Op/include/ArgMin.h index 83c643c1a..83c643c1a 100644 --- a/compiler/tflchef/tflite/src/Op/ArgMin.h +++ b/compiler/tflchef/tflite/src/Op/include/ArgMin.h diff --git a/compiler/tflchef/tflite/src/Op/AveragePool2D.h b/compiler/tflchef/tflite/src/Op/include/AveragePool2D.h index f9e9fb254..f9e9fb254 100644 --- a/compiler/tflchef/tflite/src/Op/AveragePool2D.h +++ b/compiler/tflchef/tflite/src/Op/include/AveragePool2D.h diff --git a/compiler/tflchef/tflite/src/Op/BatchMatMul.h b/compiler/tflchef/tflite/src/Op/include/BatchMatMul.h index 6eb4c6e68..6eb4c6e68 100644 --- a/compiler/tflchef/tflite/src/Op/BatchMatMul.h +++ b/compiler/tflchef/tflite/src/Op/include/BatchMatMul.h diff --git a/compiler/tflchef/tflite/src/Op/BatchToSpaceND.h b/compiler/tflchef/tflite/src/Op/include/BatchToSpaceND.h index ae2114c97..ae2114c97 100644 --- a/compiler/tflchef/tflite/src/Op/BatchToSpaceND.h +++ b/compiler/tflchef/tflite/src/Op/include/BatchToSpaceND.h diff --git a/compiler/tflchef/tflite/src/Op/include/BidirectionalSequenceLSTM.h b/compiler/tflchef/tflite/src/Op/include/BidirectionalSequenceLSTM.h new file mode 100644 index 000000000..333f542ac --- /dev/null +++ b/compiler/tflchef/tflite/src/Op/include/BidirectionalSequenceLSTM.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_BIDIRECTIONALSEQUENCE_LSTM_H__ +#define __TFLITE_OP_BIDIRECTIONALSEQUENCE_LSTM_H__ + +#include "TFliteOpChef.h" + +namespace tflchef +{ + +/** + * @brief tflchef operator builder for BidirectionalSequenceLSTM + */ +class TFliteOpBidirectionalSequenceLSTM : 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_BIDIRECTIONALSEQUENCE_LSTM_H__ diff --git a/compiler/tflchef/tflite/src/Op/Cast.h b/compiler/tflchef/tflite/src/Op/include/Cast.h index 29c126c93..29c126c93 100644 --- a/compiler/tflchef/tflite/src/Op/Cast.h +++ b/compiler/tflchef/tflite/src/Op/include/Cast.h diff --git a/compiler/tflchef/tflite/src/Op/Ceil.h b/compiler/tflchef/tflite/src/Op/include/Ceil.h index 44df20778..44df20778 100644 --- a/compiler/tflchef/tflite/src/Op/Ceil.h +++ b/compiler/tflchef/tflite/src/Op/include/Ceil.h diff --git a/compiler/tflchef/tflite/src/Op/Concatenation.h b/compiler/tflchef/tflite/src/Op/include/Concatenation.h index 4a7ea5791..4a7ea5791 100644 --- a/compiler/tflchef/tflite/src/Op/Concatenation.h +++ b/compiler/tflchef/tflite/src/Op/include/Concatenation.h diff --git a/compiler/tflchef/tflite/src/Op/Conv2D.h b/compiler/tflchef/tflite/src/Op/include/Conv2D.h index 0216e9ce9..0216e9ce9 100644 --- a/compiler/tflchef/tflite/src/Op/Conv2D.h +++ b/compiler/tflchef/tflite/src/Op/include/Conv2D.h diff --git a/compiler/tflchef/tflite/src/Op/Cos.h b/compiler/tflchef/tflite/src/Op/include/Cos.h index 8f3dbe3a6..8f3dbe3a6 100644 --- a/compiler/tflchef/tflite/src/Op/Cos.h +++ b/compiler/tflchef/tflite/src/Op/include/Cos.h diff --git a/compiler/tflchef/tflite/src/Op/DepthToSpace.h b/compiler/tflchef/tflite/src/Op/include/DepthToSpace.h index b5852ac89..b5852ac89 100644 --- a/compiler/tflchef/tflite/src/Op/DepthToSpace.h +++ b/compiler/tflchef/tflite/src/Op/include/DepthToSpace.h diff --git a/compiler/tflchef/tflite/src/Op/DepthwiseConv2D.h b/compiler/tflchef/tflite/src/Op/include/DepthwiseConv2D.h index c172536b4..c172536b4 100644 --- a/compiler/tflchef/tflite/src/Op/DepthwiseConv2D.h +++ b/compiler/tflchef/tflite/src/Op/include/DepthwiseConv2D.h diff --git a/compiler/tflchef/tflite/src/Op/include/Dequantize.h b/compiler/tflchef/tflite/src/Op/include/Dequantize.h new file mode 100644 index 000000000..df1c7bbdb --- /dev/null +++ b/compiler/tflchef/tflite/src/Op/include/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/Div.h b/compiler/tflchef/tflite/src/Op/include/Div.h index 254a4cd99..254a4cd99 100644 --- a/compiler/tflchef/tflite/src/Op/Div.h +++ b/compiler/tflchef/tflite/src/Op/include/Div.h diff --git a/compiler/tflchef/tflite/src/Op/ELU.h b/compiler/tflchef/tflite/src/Op/include/ELU.h index 490c9fde4..490c9fde4 100644 --- a/compiler/tflchef/tflite/src/Op/ELU.h +++ b/compiler/tflchef/tflite/src/Op/include/ELU.h diff --git a/compiler/tflchef/tflite/src/Op/Equal.h b/compiler/tflchef/tflite/src/Op/include/Equal.h index fd4b40001..fd4b40001 100644 --- a/compiler/tflchef/tflite/src/Op/Equal.h +++ b/compiler/tflchef/tflite/src/Op/include/Equal.h diff --git a/compiler/tflchef/tflite/src/Op/Exp.h b/compiler/tflchef/tflite/src/Op/include/Exp.h index 5ff3ddc8b..5ff3ddc8b 100644 --- a/compiler/tflchef/tflite/src/Op/Exp.h +++ b/compiler/tflchef/tflite/src/Op/include/Exp.h diff --git a/compiler/tflchef/tflite/src/Op/ExpandDims.h b/compiler/tflchef/tflite/src/Op/include/ExpandDims.h index e2f3e4e50..e2f3e4e50 100644 --- a/compiler/tflchef/tflite/src/Op/ExpandDims.h +++ b/compiler/tflchef/tflite/src/Op/include/ExpandDims.h diff --git a/compiler/tflchef/tflite/src/Op/include/FakeQuant.h b/compiler/tflchef/tflite/src/Op/include/FakeQuant.h new file mode 100644 index 000000000..f36e615df --- /dev/null +++ b/compiler/tflchef/tflite/src/Op/include/FakeQuant.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2021 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_FAKE_QUANT_H__ +#define __TFLITE_OP_FAKE_QUANT_H__ + +#include "TFliteOpChef.h" + +namespace tflchef +{ + +/** + * @brief tflchef operator builder for FakeQuant + */ +class TFliteOpFakeQuant : 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_FAKE_QUANT_H__ diff --git a/compiler/tflchef/tflite/src/Op/Fill.h b/compiler/tflchef/tflite/src/Op/include/Fill.h index 4f46f628a..4f46f628a 100644 --- a/compiler/tflchef/tflite/src/Op/Fill.h +++ b/compiler/tflchef/tflite/src/Op/include/Fill.h diff --git a/compiler/tflchef/tflite/src/Op/Floor.h b/compiler/tflchef/tflite/src/Op/include/Floor.h index f0f8ef38a..f0f8ef38a 100644 --- a/compiler/tflchef/tflite/src/Op/Floor.h +++ b/compiler/tflchef/tflite/src/Op/include/Floor.h diff --git a/compiler/tflchef/tflite/src/Op/FloorDiv.h b/compiler/tflchef/tflite/src/Op/include/FloorDiv.h index 5d049a668..5d049a668 100644 --- a/compiler/tflchef/tflite/src/Op/FloorDiv.h +++ b/compiler/tflchef/tflite/src/Op/include/FloorDiv.h diff --git a/compiler/tflchef/tflite/src/Op/FloorMod.h b/compiler/tflchef/tflite/src/Op/include/FloorMod.h index f36dfe813..f36dfe813 100644 --- a/compiler/tflchef/tflite/src/Op/FloorMod.h +++ b/compiler/tflchef/tflite/src/Op/include/FloorMod.h diff --git a/compiler/tflchef/tflite/src/Op/FullyConnected.h b/compiler/tflchef/tflite/src/Op/include/FullyConnected.h index 8fbe1f3ed..8fbe1f3ed 100644 --- a/compiler/tflchef/tflite/src/Op/FullyConnected.h +++ b/compiler/tflchef/tflite/src/Op/include/FullyConnected.h diff --git a/compiler/tflchef/tflite/src/Op/Gather.h b/compiler/tflchef/tflite/src/Op/include/Gather.h index e01276b76..e01276b76 100644 --- a/compiler/tflchef/tflite/src/Op/Gather.h +++ b/compiler/tflchef/tflite/src/Op/include/Gather.h diff --git a/compiler/tflchef/tflite/src/Op/GatherNd.h b/compiler/tflchef/tflite/src/Op/include/GatherNd.h index 112f23d33..112f23d33 100644 --- a/compiler/tflchef/tflite/src/Op/GatherNd.h +++ b/compiler/tflchef/tflite/src/Op/include/GatherNd.h diff --git a/compiler/tflchef/tflite/src/Op/include/Gelu.h b/compiler/tflchef/tflite/src/Op/include/Gelu.h new file mode 100644 index 000000000..0c51a51be --- /dev/null +++ b/compiler/tflchef/tflite/src/Op/include/Gelu.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023 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_GELU_H__ +#define __TFLITE_OP_GELU_H__ + +#include "TFliteOpChef.h" + +namespace tflchef +{ + +/** + * @brief tflchef operator builder for Gelu + */ +class TFliteOpGelu : 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_GELU_H__ diff --git a/compiler/tflchef/tflite/src/Op/Greater.h b/compiler/tflchef/tflite/src/Op/include/Greater.h index 3ab2d1a4e..3ab2d1a4e 100644 --- a/compiler/tflchef/tflite/src/Op/Greater.h +++ b/compiler/tflchef/tflite/src/Op/include/Greater.h diff --git a/compiler/tflchef/tflite/src/Op/GreaterEqual.h b/compiler/tflchef/tflite/src/Op/include/GreaterEqual.h index 96b0af78a..96b0af78a 100644 --- a/compiler/tflchef/tflite/src/Op/GreaterEqual.h +++ b/compiler/tflchef/tflite/src/Op/include/GreaterEqual.h diff --git a/compiler/tflchef/tflite/src/Op/include/HardSwish.h b/compiler/tflchef/tflite/src/Op/include/HardSwish.h new file mode 100644 index 000000000..d9b5a5382 --- /dev/null +++ b/compiler/tflchef/tflite/src/Op/include/HardSwish.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023 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_HARDSWISH_H__ +#define __TFLITE_OP_HARDSWISH_H__ + +#include "TFliteOpChef.h" + +namespace tflchef +{ + +/** + * @brief tflchef operator builder for Hard Swish + */ +class TFliteOpHardSwish : 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_HARDSWISH_H__ diff --git a/compiler/tflchef/tflite/src/Op/L2Normalize.h b/compiler/tflchef/tflite/src/Op/include/L2Normalize.h index a73eae6c8..a73eae6c8 100644 --- a/compiler/tflchef/tflite/src/Op/L2Normalize.h +++ b/compiler/tflchef/tflite/src/Op/include/L2Normalize.h diff --git a/compiler/tflchef/tflite/src/Op/L2Pool2D.h b/compiler/tflchef/tflite/src/Op/include/L2Pool2D.h index 046353440..046353440 100644 --- a/compiler/tflchef/tflite/src/Op/L2Pool2D.h +++ b/compiler/tflchef/tflite/src/Op/include/L2Pool2D.h diff --git a/compiler/tflchef/tflite/src/Op/LeakyRelu.h b/compiler/tflchef/tflite/src/Op/include/LeakyRelu.h index 28e63e0ca..28e63e0ca 100644 --- a/compiler/tflchef/tflite/src/Op/LeakyRelu.h +++ b/compiler/tflchef/tflite/src/Op/include/LeakyRelu.h diff --git a/compiler/tflchef/tflite/src/Op/Less.h b/compiler/tflchef/tflite/src/Op/include/Less.h index 1316cb613..1316cb613 100644 --- a/compiler/tflchef/tflite/src/Op/Less.h +++ b/compiler/tflchef/tflite/src/Op/include/Less.h diff --git a/compiler/tflchef/tflite/src/Op/LessEqual.h b/compiler/tflchef/tflite/src/Op/include/LessEqual.h index 81c710fbc..81c710fbc 100644 --- a/compiler/tflchef/tflite/src/Op/LessEqual.h +++ b/compiler/tflchef/tflite/src/Op/include/LessEqual.h diff --git a/compiler/tflchef/tflite/src/Op/LocalResponseNormalization.h b/compiler/tflchef/tflite/src/Op/include/LocalResponseNormalization.h index c0eb3f2b1..c0eb3f2b1 100644 --- a/compiler/tflchef/tflite/src/Op/LocalResponseNormalization.h +++ b/compiler/tflchef/tflite/src/Op/include/LocalResponseNormalization.h diff --git a/compiler/tflchef/tflite/src/Op/Log.h b/compiler/tflchef/tflite/src/Op/include/Log.h index 9d17e2f81..9d17e2f81 100644 --- a/compiler/tflchef/tflite/src/Op/Log.h +++ b/compiler/tflchef/tflite/src/Op/include/Log.h diff --git a/compiler/tflchef/tflite/src/Op/LogSoftmax.h b/compiler/tflchef/tflite/src/Op/include/LogSoftmax.h index efd81f3e9..efd81f3e9 100644 --- a/compiler/tflchef/tflite/src/Op/LogSoftmax.h +++ b/compiler/tflchef/tflite/src/Op/include/LogSoftmax.h diff --git a/compiler/tflchef/tflite/src/Op/LogicalAnd.h b/compiler/tflchef/tflite/src/Op/include/LogicalAnd.h index 1f7a964b9..1f7a964b9 100644 --- a/compiler/tflchef/tflite/src/Op/LogicalAnd.h +++ b/compiler/tflchef/tflite/src/Op/include/LogicalAnd.h diff --git a/compiler/tflchef/tflite/src/Op/LogicalNot.h b/compiler/tflchef/tflite/src/Op/include/LogicalNot.h index b75d33554..b75d33554 100644 --- a/compiler/tflchef/tflite/src/Op/LogicalNot.h +++ b/compiler/tflchef/tflite/src/Op/include/LogicalNot.h diff --git a/compiler/tflchef/tflite/src/Op/LogicalOr.h b/compiler/tflchef/tflite/src/Op/include/LogicalOr.h index 5331a0d65..5331a0d65 100644 --- a/compiler/tflchef/tflite/src/Op/LogicalOr.h +++ b/compiler/tflchef/tflite/src/Op/include/LogicalOr.h diff --git a/compiler/tflchef/tflite/src/Op/Logistic.h b/compiler/tflchef/tflite/src/Op/include/Logistic.h index a75bf490e..a75bf490e 100644 --- a/compiler/tflchef/tflite/src/Op/Logistic.h +++ b/compiler/tflchef/tflite/src/Op/include/Logistic.h diff --git a/compiler/tflchef/tflite/src/Op/MatrixDiag.h b/compiler/tflchef/tflite/src/Op/include/MatrixDiag.h index 4074f2c36..4074f2c36 100644 --- a/compiler/tflchef/tflite/src/Op/MatrixDiag.h +++ b/compiler/tflchef/tflite/src/Op/include/MatrixDiag.h diff --git a/compiler/tflchef/tflite/src/Op/MatrixSetDiag.h b/compiler/tflchef/tflite/src/Op/include/MatrixSetDiag.h index 0e7ec7f32..0e7ec7f32 100644 --- a/compiler/tflchef/tflite/src/Op/MatrixSetDiag.h +++ b/compiler/tflchef/tflite/src/Op/include/MatrixSetDiag.h diff --git a/compiler/tflchef/tflite/src/Op/MaxPool2D.h b/compiler/tflchef/tflite/src/Op/include/MaxPool2D.h index 36533f80c..36533f80c 100644 --- a/compiler/tflchef/tflite/src/Op/MaxPool2D.h +++ b/compiler/tflchef/tflite/src/Op/include/MaxPool2D.h diff --git a/compiler/tflchef/tflite/src/Op/Maximum.h b/compiler/tflchef/tflite/src/Op/include/Maximum.h index acafec343..acafec343 100644 --- a/compiler/tflchef/tflite/src/Op/Maximum.h +++ b/compiler/tflchef/tflite/src/Op/include/Maximum.h diff --git a/compiler/tflchef/tflite/src/Op/Mean.h b/compiler/tflchef/tflite/src/Op/include/Mean.h index 532c40c66..532c40c66 100644 --- a/compiler/tflchef/tflite/src/Op/Mean.h +++ b/compiler/tflchef/tflite/src/Op/include/Mean.h diff --git a/compiler/tflchef/tflite/src/Op/Minimum.h b/compiler/tflchef/tflite/src/Op/include/Minimum.h index 5db5b7940..5db5b7940 100644 --- a/compiler/tflchef/tflite/src/Op/Minimum.h +++ b/compiler/tflchef/tflite/src/Op/include/Minimum.h diff --git a/compiler/tflchef/tflite/src/Op/MirrorPad.h b/compiler/tflchef/tflite/src/Op/include/MirrorPad.h index c9acdd498..c9acdd498 100644 --- a/compiler/tflchef/tflite/src/Op/MirrorPad.h +++ b/compiler/tflchef/tflite/src/Op/include/MirrorPad.h diff --git a/compiler/tflchef/tflite/src/Op/Mul.h b/compiler/tflchef/tflite/src/Op/include/Mul.h index fd009d2fd..fd009d2fd 100644 --- a/compiler/tflchef/tflite/src/Op/Mul.h +++ b/compiler/tflchef/tflite/src/Op/include/Mul.h diff --git a/compiler/tflchef/tflite/src/Op/Neg.h b/compiler/tflchef/tflite/src/Op/include/Neg.h index c77ab7e84..c77ab7e84 100644 --- a/compiler/tflchef/tflite/src/Op/Neg.h +++ b/compiler/tflchef/tflite/src/Op/include/Neg.h diff --git a/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV4.h b/compiler/tflchef/tflite/src/Op/include/NonMaxSuppressionV4.h index 114a2ad2f..114a2ad2f 100644 --- a/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV4.h +++ b/compiler/tflchef/tflite/src/Op/include/NonMaxSuppressionV4.h diff --git a/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV5.h b/compiler/tflchef/tflite/src/Op/include/NonMaxSuppressionV5.h index c948043f4..c948043f4 100644 --- a/compiler/tflchef/tflite/src/Op/NonMaxSuppressionV5.h +++ b/compiler/tflchef/tflite/src/Op/include/NonMaxSuppressionV5.h diff --git a/compiler/tflchef/tflite/src/Op/NotEqual.h b/compiler/tflchef/tflite/src/Op/include/NotEqual.h index b1febdcc5..b1febdcc5 100644 --- a/compiler/tflchef/tflite/src/Op/NotEqual.h +++ b/compiler/tflchef/tflite/src/Op/include/NotEqual.h diff --git a/compiler/tflchef/tflite/src/Op/OneHot.h b/compiler/tflchef/tflite/src/Op/include/OneHot.h index 50bbed095..50bbed095 100644 --- a/compiler/tflchef/tflite/src/Op/OneHot.h +++ b/compiler/tflchef/tflite/src/Op/include/OneHot.h diff --git a/compiler/tflchef/tflite/src/Op/PRelu.h b/compiler/tflchef/tflite/src/Op/include/PRelu.h index b35c6e7ce..b35c6e7ce 100644 --- a/compiler/tflchef/tflite/src/Op/PRelu.h +++ b/compiler/tflchef/tflite/src/Op/include/PRelu.h diff --git a/compiler/tflchef/tflite/src/Op/Pack.h b/compiler/tflchef/tflite/src/Op/include/Pack.h index 7779f64ed..7779f64ed 100644 --- a/compiler/tflchef/tflite/src/Op/Pack.h +++ b/compiler/tflchef/tflite/src/Op/include/Pack.h diff --git a/compiler/tflchef/tflite/src/Op/Pad.h b/compiler/tflchef/tflite/src/Op/include/Pad.h index 99998d418..99998d418 100644 --- a/compiler/tflchef/tflite/src/Op/Pad.h +++ b/compiler/tflchef/tflite/src/Op/include/Pad.h diff --git a/compiler/tflchef/tflite/src/Op/PadV2.h b/compiler/tflchef/tflite/src/Op/include/PadV2.h index 3aa474b92..3aa474b92 100644 --- a/compiler/tflchef/tflite/src/Op/PadV2.h +++ b/compiler/tflchef/tflite/src/Op/include/PadV2.h diff --git a/compiler/tflchef/tflite/src/Op/Pow.h b/compiler/tflchef/tflite/src/Op/include/Pow.h index 20e847377..20e847377 100644 --- a/compiler/tflchef/tflite/src/Op/Pow.h +++ b/compiler/tflchef/tflite/src/Op/include/Pow.h diff --git a/compiler/tflchef/tflite/src/Op/include/Quantize.h b/compiler/tflchef/tflite/src/Op/include/Quantize.h new file mode 100644 index 000000000..256ed5a5c --- /dev/null +++ b/compiler/tflchef/tflite/src/Op/include/Quantize.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2021 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_QUANTIZE_H__ +#define __TFLITE_OP_QUANTIZE_H__ + +#include "TFliteOpChef.h" + +namespace tflchef +{ + +/** + * @brief tflchef operator builder for Quantize + */ +class TFliteOpQuantize : 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_QUANTIZE_H__ diff --git a/compiler/tflchef/tflite/src/Op/Range.h b/compiler/tflchef/tflite/src/Op/include/Range.h index ad10dc58b..ad10dc58b 100644 --- a/compiler/tflchef/tflite/src/Op/Range.h +++ b/compiler/tflchef/tflite/src/Op/include/Range.h diff --git a/compiler/tflchef/tflite/src/Op/Rank.h b/compiler/tflchef/tflite/src/Op/include/Rank.h index 003d9d310..003d9d310 100644 --- a/compiler/tflchef/tflite/src/Op/Rank.h +++ b/compiler/tflchef/tflite/src/Op/include/Rank.h diff --git a/compiler/tflchef/tflite/src/Op/ReLU.h b/compiler/tflchef/tflite/src/Op/include/ReLU.h index be1090270..be1090270 100644 --- a/compiler/tflchef/tflite/src/Op/ReLU.h +++ b/compiler/tflchef/tflite/src/Op/include/ReLU.h diff --git a/compiler/tflchef/tflite/src/Op/ReLU6.h b/compiler/tflchef/tflite/src/Op/include/ReLU6.h index 64ddb6a2e..64ddb6a2e 100644 --- a/compiler/tflchef/tflite/src/Op/ReLU6.h +++ b/compiler/tflchef/tflite/src/Op/include/ReLU6.h diff --git a/compiler/tflchef/tflite/src/Op/ReLUN1To1.h b/compiler/tflchef/tflite/src/Op/include/ReLUN1To1.h index 0767006af..0767006af 100644 --- a/compiler/tflchef/tflite/src/Op/ReLUN1To1.h +++ b/compiler/tflchef/tflite/src/Op/include/ReLUN1To1.h diff --git a/compiler/tflchef/tflite/src/Op/ReduceAny.h b/compiler/tflchef/tflite/src/Op/include/ReduceAny.h index dd5e361d5..dd5e361d5 100644 --- a/compiler/tflchef/tflite/src/Op/ReduceAny.h +++ b/compiler/tflchef/tflite/src/Op/include/ReduceAny.h diff --git a/compiler/tflchef/tflite/src/Op/ReduceMax.h b/compiler/tflchef/tflite/src/Op/include/ReduceMax.h index 8e65cf47c..8e65cf47c 100644 --- a/compiler/tflchef/tflite/src/Op/ReduceMax.h +++ b/compiler/tflchef/tflite/src/Op/include/ReduceMax.h diff --git a/compiler/tflchef/tflite/src/Op/ReduceMin.h b/compiler/tflchef/tflite/src/Op/include/ReduceMin.h index 88cba6fe7..88cba6fe7 100644 --- a/compiler/tflchef/tflite/src/Op/ReduceMin.h +++ b/compiler/tflchef/tflite/src/Op/include/ReduceMin.h diff --git a/compiler/tflchef/tflite/src/Op/ReduceProd.h b/compiler/tflchef/tflite/src/Op/include/ReduceProd.h index e7766840a..e7766840a 100644 --- a/compiler/tflchef/tflite/src/Op/ReduceProd.h +++ b/compiler/tflchef/tflite/src/Op/include/ReduceProd.h diff --git a/compiler/tflchef/tflite/src/Op/Reshape.h b/compiler/tflchef/tflite/src/Op/include/Reshape.h index be9fdac08..be9fdac08 100644 --- a/compiler/tflchef/tflite/src/Op/Reshape.h +++ b/compiler/tflchef/tflite/src/Op/include/Reshape.h diff --git a/compiler/tflchef/tflite/src/Op/ResizeBilinear.h b/compiler/tflchef/tflite/src/Op/include/ResizeBilinear.h index 98c49c534..98c49c534 100644 --- a/compiler/tflchef/tflite/src/Op/ResizeBilinear.h +++ b/compiler/tflchef/tflite/src/Op/include/ResizeBilinear.h diff --git a/compiler/tflchef/tflite/src/Op/ResizeNearestNeighbor.h b/compiler/tflchef/tflite/src/Op/include/ResizeNearestNeighbor.h index 5090bb938..5090bb938 100644 --- a/compiler/tflchef/tflite/src/Op/ResizeNearestNeighbor.h +++ b/compiler/tflchef/tflite/src/Op/include/ResizeNearestNeighbor.h diff --git a/compiler/tflchef/tflite/src/Op/ReverseSequence.h b/compiler/tflchef/tflite/src/Op/include/ReverseSequence.h index 8c8c811e4..8c8c811e4 100644 --- a/compiler/tflchef/tflite/src/Op/ReverseSequence.h +++ b/compiler/tflchef/tflite/src/Op/include/ReverseSequence.h diff --git a/compiler/tflchef/tflite/src/Op/ReverseV2.h b/compiler/tflchef/tflite/src/Op/include/ReverseV2.h index 6a8a75e6b..6a8a75e6b 100644 --- a/compiler/tflchef/tflite/src/Op/ReverseV2.h +++ b/compiler/tflchef/tflite/src/Op/include/ReverseV2.h diff --git a/compiler/tflchef/tflite/src/Op/Round.h b/compiler/tflchef/tflite/src/Op/include/Round.h index df0da3fa1..df0da3fa1 100644 --- a/compiler/tflchef/tflite/src/Op/Round.h +++ b/compiler/tflchef/tflite/src/Op/include/Round.h diff --git a/compiler/tflchef/tflite/src/Op/Rsqrt.h b/compiler/tflchef/tflite/src/Op/include/Rsqrt.h index 5d68344c2..5d68344c2 100644 --- a/compiler/tflchef/tflite/src/Op/Rsqrt.h +++ b/compiler/tflchef/tflite/src/Op/include/Rsqrt.h diff --git a/compiler/tflchef/tflite/src/Op/include/SVDF.h b/compiler/tflchef/tflite/src/Op/include/SVDF.h new file mode 100644 index 000000000..a59ca54a2 --- /dev/null +++ b/compiler/tflchef/tflite/src/Op/include/SVDF.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022 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_SVDF_H__ +#define __TFLITE_OP_SVDF_H__ + +#include "TFliteOpChef.h" + +namespace tflchef +{ + +/** + * @brief tflchef operator builder for SVDF + */ +class TFliteOpSVDF : 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_SVDF_H__ diff --git a/compiler/tflchef/tflite/src/Op/ScatterNd.h b/compiler/tflchef/tflite/src/Op/include/ScatterNd.h index 76362d775..76362d775 100644 --- a/compiler/tflchef/tflite/src/Op/ScatterNd.h +++ b/compiler/tflchef/tflite/src/Op/include/ScatterNd.h diff --git a/compiler/tflchef/tflite/src/Op/SegmentSum.h b/compiler/tflchef/tflite/src/Op/include/SegmentSum.h index d20e63bd7..d20e63bd7 100644 --- a/compiler/tflchef/tflite/src/Op/SegmentSum.h +++ b/compiler/tflchef/tflite/src/Op/include/SegmentSum.h diff --git a/compiler/tflchef/tflite/src/Op/Select.h b/compiler/tflchef/tflite/src/Op/include/Select.h index bf8e57d78..bf8e57d78 100644 --- a/compiler/tflchef/tflite/src/Op/Select.h +++ b/compiler/tflchef/tflite/src/Op/include/Select.h diff --git a/compiler/tflchef/tflite/src/Op/SelectV2.h b/compiler/tflchef/tflite/src/Op/include/SelectV2.h index ff03341d7..ff03341d7 100644 --- a/compiler/tflchef/tflite/src/Op/SelectV2.h +++ b/compiler/tflchef/tflite/src/Op/include/SelectV2.h diff --git a/compiler/tflchef/tflite/src/Op/Shape.h b/compiler/tflchef/tflite/src/Op/include/Shape.h index ebe1befb3..ebe1befb3 100644 --- a/compiler/tflchef/tflite/src/Op/Shape.h +++ b/compiler/tflchef/tflite/src/Op/include/Shape.h diff --git a/compiler/tflchef/tflite/src/Op/Sin.h b/compiler/tflchef/tflite/src/Op/include/Sin.h index 51eabceb5..51eabceb5 100644 --- a/compiler/tflchef/tflite/src/Op/Sin.h +++ b/compiler/tflchef/tflite/src/Op/include/Sin.h diff --git a/compiler/tflchef/tflite/src/Op/Slice.h b/compiler/tflchef/tflite/src/Op/include/Slice.h index 6ca6724d3..6ca6724d3 100644 --- a/compiler/tflchef/tflite/src/Op/Slice.h +++ b/compiler/tflchef/tflite/src/Op/include/Slice.h diff --git a/compiler/tflchef/tflite/src/Op/Softmax.h b/compiler/tflchef/tflite/src/Op/include/Softmax.h index cf168bdd9..cf168bdd9 100644 --- a/compiler/tflchef/tflite/src/Op/Softmax.h +++ b/compiler/tflchef/tflite/src/Op/include/Softmax.h diff --git a/compiler/tflchef/tflite/src/Op/SpaceToBatchND.h b/compiler/tflchef/tflite/src/Op/include/SpaceToBatchND.h index 9d7bc44e8..9d7bc44e8 100644 --- a/compiler/tflchef/tflite/src/Op/SpaceToBatchND.h +++ b/compiler/tflchef/tflite/src/Op/include/SpaceToBatchND.h diff --git a/compiler/tflchef/tflite/src/Op/SpaceToDepth.h b/compiler/tflchef/tflite/src/Op/include/SpaceToDepth.h index 784ad940a..784ad940a 100644 --- a/compiler/tflchef/tflite/src/Op/SpaceToDepth.h +++ b/compiler/tflchef/tflite/src/Op/include/SpaceToDepth.h diff --git a/compiler/tflchef/tflite/src/Op/SparseToDense.h b/compiler/tflchef/tflite/src/Op/include/SparseToDense.h index 5ffe4789d..5ffe4789d 100644 --- a/compiler/tflchef/tflite/src/Op/SparseToDense.h +++ b/compiler/tflchef/tflite/src/Op/include/SparseToDense.h diff --git a/compiler/tflchef/tflite/src/Op/Split.h b/compiler/tflchef/tflite/src/Op/include/Split.h index af247a1b9..af247a1b9 100644 --- a/compiler/tflchef/tflite/src/Op/Split.h +++ b/compiler/tflchef/tflite/src/Op/include/Split.h diff --git a/compiler/tflchef/tflite/src/Op/SplitV.h b/compiler/tflchef/tflite/src/Op/include/SplitV.h index 3f715b5f9..3f715b5f9 100644 --- a/compiler/tflchef/tflite/src/Op/SplitV.h +++ b/compiler/tflchef/tflite/src/Op/include/SplitV.h diff --git a/compiler/tflchef/tflite/src/Op/Sqrt.h b/compiler/tflchef/tflite/src/Op/include/Sqrt.h index 9f0ad04ae..9f0ad04ae 100644 --- a/compiler/tflchef/tflite/src/Op/Sqrt.h +++ b/compiler/tflchef/tflite/src/Op/include/Sqrt.h diff --git a/compiler/tflchef/tflite/src/Op/Square.h b/compiler/tflchef/tflite/src/Op/include/Square.h index 9c008fe52..9c008fe52 100644 --- a/compiler/tflchef/tflite/src/Op/Square.h +++ b/compiler/tflchef/tflite/src/Op/include/Square.h diff --git a/compiler/tflchef/tflite/src/Op/SquaredDifference.h b/compiler/tflchef/tflite/src/Op/include/SquaredDifference.h index 58c2ed460..58c2ed460 100644 --- a/compiler/tflchef/tflite/src/Op/SquaredDifference.h +++ b/compiler/tflchef/tflite/src/Op/include/SquaredDifference.h diff --git a/compiler/tflchef/tflite/src/Op/Squeeze.h b/compiler/tflchef/tflite/src/Op/include/Squeeze.h index b6c89f73d..b6c89f73d 100644 --- a/compiler/tflchef/tflite/src/Op/Squeeze.h +++ b/compiler/tflchef/tflite/src/Op/include/Squeeze.h diff --git a/compiler/tflchef/tflite/src/Op/StridedSlice.h b/compiler/tflchef/tflite/src/Op/include/StridedSlice.h index 98054b9b9..98054b9b9 100644 --- a/compiler/tflchef/tflite/src/Op/StridedSlice.h +++ b/compiler/tflchef/tflite/src/Op/include/StridedSlice.h diff --git a/compiler/tflchef/tflite/src/Op/Sub.h b/compiler/tflchef/tflite/src/Op/include/Sub.h index 2168e5e0d..2168e5e0d 100644 --- a/compiler/tflchef/tflite/src/Op/Sub.h +++ b/compiler/tflchef/tflite/src/Op/include/Sub.h diff --git a/compiler/tflchef/tflite/src/Op/Sum.h b/compiler/tflchef/tflite/src/Op/include/Sum.h index 38eeb080d..38eeb080d 100644 --- a/compiler/tflchef/tflite/src/Op/Sum.h +++ b/compiler/tflchef/tflite/src/Op/include/Sum.h diff --git a/compiler/tflchef/tflite/src/Op/Tanh.h b/compiler/tflchef/tflite/src/Op/include/Tanh.h index 7339e4103..7339e4103 100644 --- a/compiler/tflchef/tflite/src/Op/Tanh.h +++ b/compiler/tflchef/tflite/src/Op/include/Tanh.h diff --git a/compiler/tflchef/tflite/src/Op/Tile.h b/compiler/tflchef/tflite/src/Op/include/Tile.h index 640f52a1f..640f52a1f 100644 --- a/compiler/tflchef/tflite/src/Op/Tile.h +++ b/compiler/tflchef/tflite/src/Op/include/Tile.h diff --git a/compiler/tflchef/tflite/src/Op/TopKV2.h b/compiler/tflchef/tflite/src/Op/include/TopKV2.h index b2b74cc75..b2b74cc75 100644 --- a/compiler/tflchef/tflite/src/Op/TopKV2.h +++ b/compiler/tflchef/tflite/src/Op/include/TopKV2.h diff --git a/compiler/tflchef/tflite/src/Op/Transpose.h b/compiler/tflchef/tflite/src/Op/include/Transpose.h index f0d944b6b..f0d944b6b 100644 --- a/compiler/tflchef/tflite/src/Op/Transpose.h +++ b/compiler/tflchef/tflite/src/Op/include/Transpose.h diff --git a/compiler/tflchef/tflite/src/Op/TransposeConv.h b/compiler/tflchef/tflite/src/Op/include/TransposeConv.h index c79cdabd2..c79cdabd2 100644 --- a/compiler/tflchef/tflite/src/Op/TransposeConv.h +++ b/compiler/tflchef/tflite/src/Op/include/TransposeConv.h diff --git a/compiler/tflchef/tflite/src/Op/include/UnidirectionalSequenceLSTM.h b/compiler/tflchef/tflite/src/Op/include/UnidirectionalSequenceLSTM.h new file mode 100644 index 000000000..cc4e5fb0f --- /dev/null +++ b/compiler/tflchef/tflite/src/Op/include/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.h b/compiler/tflchef/tflite/src/Op/include/Unique.h index fae037c9f..fae037c9f 100644 --- a/compiler/tflchef/tflite/src/Op/Unique.h +++ b/compiler/tflchef/tflite/src/Op/include/Unique.h diff --git a/compiler/tflchef/tflite/src/Op/Unpack.h b/compiler/tflchef/tflite/src/Op/include/Unpack.h index 1036bdc14..1036bdc14 100644 --- a/compiler/tflchef/tflite/src/Op/Unpack.h +++ b/compiler/tflchef/tflite/src/Op/include/Unpack.h diff --git a/compiler/tflchef/tflite/src/Op/Where.h b/compiler/tflchef/tflite/src/Op/include/Where.h index 00cdc4b00..00cdc4b00 100644 --- a/compiler/tflchef/tflite/src/Op/Where.h +++ b/compiler/tflchef/tflite/src/Op/include/Where.h diff --git a/compiler/tflchef/tflite/src/Op/ZerosLike.h b/compiler/tflchef/tflite/src/Op/include/ZerosLike.h index 163c1fa21..163c1fa21 100644 --- a/compiler/tflchef/tflite/src/Op/ZerosLike.h +++ b/compiler/tflchef/tflite/src/Op/include/ZerosLike.h diff --git a/compiler/tflchef/tflite/src/RecipeChef.cpp b/compiler/tflchef/tflite/src/RecipeChef.cpp index 088961c1c..2203f5906 100644 --- a/compiler/tflchef/tflite/src/RecipeChef.cpp +++ b/compiler/tflchef/tflite/src/RecipeChef.cpp @@ -15,6 +15,7 @@ */ #include <tflchef/RecipeChef.h> +#include <mio_tflite2121/Helper.h> #include "Convert.h" #include "TFliteImport.h" @@ -42,7 +43,7 @@ void set_inputs(TFliteImport *import, tflchef::Operation *operation, const tflit else { auto tensor = tensors->Get(input); - std::string name = tensor_name(tensor); + std::string name = mio::tflite::tensor_name(tensor); operation->add_input(name); } } @@ -56,7 +57,7 @@ void set_outputs(TFliteImport *import, tflchef::Operation *operation, const tfli for (auto output : outputs) { auto tensor = tensors->Get(output); - std::string name = tensor_name(tensor); + std::string name = mio::tflite::tensor_name(tensor); operation->add_output(name); } } @@ -108,8 +109,9 @@ std::unique_ptr<ModelRecipe> generate_recipe(const tflite::Model *model) ::tflchef::Operand *operand = model_recipe->add_operand(); - operand->set_name(tensor_name(tensor)); + operand->set_name(mio::tflite::tensor_name(tensor)); operand->set_type(as_tflchef_type(tensor->type())); + operand->set_is_variable(tensor->is_variable()); if (tensor->shape()) { @@ -187,6 +189,99 @@ std::unique_ptr<ModelRecipe> generate_recipe(const tflite::Model *model) 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)); + } + } } // add all operators @@ -217,14 +312,14 @@ std::unique_ptr<ModelRecipe> generate_recipe(const tflite::Model *model) for (const auto input : inputs) { auto tensor = tensors->Get(input); - std::string name = tensor_name(tensor); + std::string name = mio::tflite::tensor_name(tensor); model_recipe->add_input(name); } for (const auto output : outputs) { auto tensor = tensors->Get(output); - std::string name = tensor_name(tensor); + std::string name = mio::tflite::tensor_name(tensor); model_recipe->add_output(name); } diff --git a/compiler/tflchef/tflite/src/TFliteImport.cpp b/compiler/tflchef/tflite/src/TFliteImport.cpp index 51d9b5ffa..9abec9a08 100644 --- a/compiler/tflchef/tflite/src/TFliteImport.cpp +++ b/compiler/tflchef/tflite/src/TFliteImport.cpp @@ -18,38 +18,13 @@ #include "Convert.h" +#include <mio_tflite2121/Helper.h> + #include <sstream> namespace tflchef { -const char *kEmptyTensorName = "(noname)"; - -const char *tensor_type(const tflite::Tensor *tensor) -{ - return tflite::EnumNameTensorType(tensor->type()); -} - -const char *tensor_name(const tflite::Tensor *tensor) -{ - auto name = tensor->name(); - if (name) - return name->c_str(); - return kEmptyTensorName; -} - -bool is_valid(const tflite::OperatorCode *opcode) -{ - tflite::BuiltinOperator code = opcode->builtin_code(); - return (tflite::BuiltinOperator_MIN <= code && code <= tflite::BuiltinOperator_MAX); -} - -bool is_custom(const tflite::OperatorCode *opcode) -{ - tflite::BuiltinOperator code = opcode->builtin_code(); - return (code == tflite::BuiltinOperator_CUSTOM); -} - TFliteImport::TFliteImport(const tflite::Model *model) { _subgraphs = model->subgraphs(); @@ -92,7 +67,7 @@ tflite::BuiltinOperator TFliteImport::builtin_code(const tflite::Operator *op) c assert(index < _op_codes.size()); const tflite::OperatorCode *opcode = _op_codes.at(index); - return opcode->builtin_code(); + return mio::tflite::builtin_code_neutral(opcode); } std::string TFliteImport::opcode_name(const tflite::Operator *op) const @@ -101,14 +76,14 @@ std::string TFliteImport::opcode_name(const tflite::Operator *op) const assert(index < _op_codes.size()); const tflite::OperatorCode *opcode = _op_codes.at(index); - if (!is_valid(opcode)) + if (!mio::tflite::is_valid(opcode)) { std::ostringstream oss; oss << "(invalid: " << index << ")"; return oss.str(); } - if (is_custom(opcode)) + if (mio::tflite::is_custom(opcode)) { if (!opcode->custom_code()) return "(invalid custom)"; @@ -116,7 +91,7 @@ std::string TFliteImport::opcode_name(const tflite::Operator *op) const return opcode->custom_code()->c_str(); } - tflite::BuiltinOperator code = opcode->builtin_code(); + tflite::BuiltinOperator code = mio::tflite::builtin_code_neutral(opcode); return EnumNameBuiltinOperator(code); } diff --git a/compiler/tflchef/tflite/src/TFliteImport.h b/compiler/tflchef/tflite/src/TFliteImport.h index 9d0a642ab..e6722e455 100644 --- a/compiler/tflchef/tflite/src/TFliteImport.h +++ b/compiler/tflchef/tflite/src/TFliteImport.h @@ -34,11 +34,6 @@ using TFliteTensors_t = flatbuffers::Vector<flatbuffers::Offset<tflite::Tensor>> using TFliteBuffers_t = flatbuffers::Vector<flatbuffers::Offset<tflite::Buffer>>; using TFliteOperators_t = flatbuffers::Vector<flatbuffers::Offset<tflite::Operator>>; -const char *tensor_type(const tflite::Tensor *tensor); -const char *tensor_name(const tflite::Tensor *tensor); -bool is_valid(const tflite::OperatorCode *opcode); -bool is_custom(const tflite::OperatorCode *opcode); - /** * @brief Loads TF lite file and provides helpers to access attributes */ diff --git a/compiler/tflchef/tflite/src/TFliteOpChefs.h b/compiler/tflchef/tflite/src/TFliteOpChefs.h index 36a010957..34cb1bae2 100644 --- a/compiler/tflchef/tflite/src/TFliteOpChefs.h +++ b/compiler/tflchef/tflite/src/TFliteOpChefs.h @@ -18,109 +18,117 @@ #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/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/Unique.h" -#include "Op/Unpack.h" -#include "Op/Where.h" -#include "Op/ZerosLike.h" +#include "Op/include/Abs.h" +#include "Op/include/Add.h" +#include "Op/include/AddN.h" +#include "Op/include/ArgMax.h" +#include "Op/include/ArgMin.h" +#include "Op/include/AveragePool2D.h" +#include "Op/include/BatchMatMul.h" +#include "Op/include/BatchToSpaceND.h" +#include "Op/include/BidirectionalSequenceLSTM.h" +#include "Op/include/Cast.h" +#include "Op/include/Ceil.h" +#include "Op/include/Concatenation.h" +#include "Op/include/Conv2D.h" +#include "Op/include/Cos.h" +#include "Op/include/DepthToSpace.h" +#include "Op/include/DepthwiseConv2D.h" +#include "Op/include/Dequantize.h" +#include "Op/include/Div.h" +#include "Op/include/ELU.h" +#include "Op/include/Equal.h" +#include "Op/include/Exp.h" +#include "Op/include/ExpandDims.h" +#include "Op/include/FakeQuant.h" +#include "Op/include/Fill.h" +#include "Op/include/Floor.h" +#include "Op/include/FloorDiv.h" +#include "Op/include/FloorMod.h" +#include "Op/include/FullyConnected.h" +#include "Op/include/Gather.h" +#include "Op/include/GatherNd.h" +#include "Op/include/Gelu.h" +#include "Op/include/Greater.h" +#include "Op/include/GreaterEqual.h" +#include "Op/include/HardSwish.h" +#include "Op/include/L2Normalize.h" +#include "Op/include/L2Pool2D.h" +#include "Op/include/LeakyRelu.h" +#include "Op/include/Less.h" +#include "Op/include/LessEqual.h" +#include "Op/include/LocalResponseNormalization.h" +#include "Op/include/Log.h" +#include "Op/include/LogicalAnd.h" +#include "Op/include/LogicalNot.h" +#include "Op/include/LogicalOr.h" +#include "Op/include/Logistic.h" +#include "Op/include/LogSoftmax.h" +#include "Op/include/MatrixDiag.h" +#include "Op/include/MatrixSetDiag.h" +#include "Op/include/Maximum.h" +#include "Op/include/MaxPool2D.h" +#include "Op/include/Mean.h" +#include "Op/include/Minimum.h" +#include "Op/include/MirrorPad.h" +#include "Op/include/Mul.h" +#include "Op/include/Neg.h" +#include "Op/include/NonMaxSuppressionV4.h" +#include "Op/include/NonMaxSuppressionV5.h" +#include "Op/include/NotEqual.h" +#include "Op/include/OneHot.h" +#include "Op/include/Pack.h" +#include "Op/include/Pad.h" +#include "Op/include/PadV2.h" +#include "Op/include/Pow.h" +#include "Op/include/PRelu.h" +#include "Op/include/Quantize.h" +#include "Op/include/Range.h" +#include "Op/include/Rank.h" +#include "Op/include/ReduceAny.h" +#include "Op/include/ReduceMax.h" +#include "Op/include/ReduceMin.h" +#include "Op/include/ReduceProd.h" +#include "Op/include/ReLU.h" +#include "Op/include/ReLU6.h" +#include "Op/include/ReLUN1To1.h" +#include "Op/include/Reshape.h" +#include "Op/include/ResizeBilinear.h" +#include "Op/include/ResizeNearestNeighbor.h" +#include "Op/include/ReverseSequence.h" +#include "Op/include/ReverseV2.h" +#include "Op/include/Round.h" +#include "Op/include/Rsqrt.h" +#include "Op/include/ScatterNd.h" +#include "Op/include/SegmentSum.h" +#include "Op/include/Select.h" +#include "Op/include/SelectV2.h" +#include "Op/include/Shape.h" +#include "Op/include/Sin.h" +#include "Op/include/Slice.h" +#include "Op/include/Softmax.h" +#include "Op/include/SpaceToBatchND.h" +#include "Op/include/SpaceToDepth.h" +#include "Op/include/SparseToDense.h" +#include "Op/include/Split.h" +#include "Op/include/SplitV.h" +#include "Op/include/Sqrt.h" +#include "Op/include/Square.h" +#include "Op/include/SquaredDifference.h" +#include "Op/include/Squeeze.h" +#include "Op/include/StridedSlice.h" +#include "Op/include/Sub.h" +#include "Op/include/Sum.h" +#include "Op/include/SVDF.h" +#include "Op/include/Tanh.h" +#include "Op/include/Tile.h" +#include "Op/include/TopKV2.h" +#include "Op/include/Transpose.h" +#include "Op/include/TransposeConv.h" +#include "Op/include/UnidirectionalSequenceLSTM.h" +#include "Op/include/Unique.h" +#include "Op/include/Unpack.h" +#include "Op/include/Where.h" +#include "Op/include/ZerosLike.h" #endif // __TFLITE_OP_CHEFS_H__ diff --git a/compiler/tflchef/tflite/src/TFliteOpRegistry.h b/compiler/tflchef/tflite/src/TFliteOpRegistry.h index a454e98b6..a37f15c0c 100644 --- a/compiler/tflchef/tflite/src/TFliteOpRegistry.h +++ b/compiler/tflchef/tflite/src/TFliteOpRegistry.h @@ -63,6 +63,7 @@ private: REG_TFL_OP(AVERAGE_POOL_2D, TFliteOpAveragePool2D); REG_TFL_OP(BATCH_MATMUL, TFliteOpBatchMatMul); REG_TFL_OP(BATCH_TO_SPACE_ND, TFliteOpBatchToSpaceND); + REG_TFL_OP(BIDIRECTIONAL_SEQUENCE_LSTM, TFliteOpBidirectionalSequenceLSTM); REG_TFL_OP(CAST, TFliteOpCast); REG_TFL_OP(CEIL, TFliteOpCeil); REG_TFL_OP(CONCATENATION, TFliteOpConcatenation); @@ -70,11 +71,13 @@ private: 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(FAKE_QUANT, TFliteOpFakeQuant); REG_TFL_OP(FILL, TFliteOpFill); REG_TFL_OP(FLOOR, TFliteOpFloor); REG_TFL_OP(FLOOR_DIV, TFliteOpFloorDiv); @@ -82,8 +85,10 @@ private: REG_TFL_OP(FULLY_CONNECTED, TFliteOpFullyConnected); REG_TFL_OP(GATHER, TFliteOpGather); REG_TFL_OP(GATHER_ND, TFliteOpGatherNd); + REG_TFL_OP(GELU, TFliteOpGelu); REG_TFL_OP(GREATER, TFliteOpGreater); REG_TFL_OP(GREATER_EQUAL, TFliteOpGreaterEqual); + REG_TFL_OP(HARD_SWISH, TFliteOpHardSwish); REG_TFL_OP(L2_NORMALIZATION, TFliteOpL2Normalize); REG_TFL_OP(L2_POOL_2D, TFliteOpL2Pool2D); REG_TFL_OP(LEAKY_RELU, TFliteOpLeakyRelu); @@ -114,6 +119,7 @@ private: REG_TFL_OP(PADV2, TFliteOpPadV2); REG_TFL_OP(POW, TFliteOpPow); REG_TFL_OP(PRELU, TFliteOpPRelu); + REG_TFL_OP(QUANTIZE, TFliteOpQuantize); REG_TFL_OP(RANGE, TFliteOpRange); REG_TFL_OP(RANK, TFliteOpRank); REG_TFL_OP(REDUCE_ANY, TFliteOpReduceAny); @@ -150,11 +156,13 @@ private: REG_TFL_OP(STRIDED_SLICE, TFliteOpStridedSlice); REG_TFL_OP(SUB, TFliteOpSub); REG_TFL_OP(SUM, TFliteOpSum); + REG_TFL_OP(SVDF, TFliteOpSVDF); 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); |