From 319cbf24756d577dea554513dcc6435c056ef6ce Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9D=B4=ED=95=9C=EC=A2=85/On-Device=20Lab=28SR=29/Enginee?= =?utf8?q?r/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Mon, 18 Nov 2019 13:21:38 +0900 Subject: [PATCH] [neurun] Introduce OpCode enum type (#8977) Introduce OpCode enum type for operations. Each operation has its unique OpCode value. Resolve #8858 Signed-off-by: Hanjoung Lee --- runtime/neurun/core/include/model/OpCode.h | 40 ++++++++++++++++++++++ runtime/neurun/core/include/model/Operation.h | 2 ++ runtime/neurun/core/include/model/Subgraph.h | 1 + runtime/neurun/core/include/model/operation/Abs.h | 1 + runtime/neurun/core/include/model/operation/Add.h | 1 + .../neurun/core/include/model/operation/ArgMax.h | 1 + .../core/include/model/operation/AvgPool2D.h | 1 + .../core/include/model/operation/BatchToSpaceND.h | 1 + runtime/neurun/core/include/model/operation/Cast.h | 1 + .../core/include/model/operation/Comparison.h | 1 + .../neurun/core/include/model/operation/Concat.h | 1 + .../neurun/core/include/model/operation/Conv2D.h | 1 + .../neurun/core/include/model/operation/Custom.h | 1 + .../core/include/model/operation/DepthToSpace.h | 1 + .../core/include/model/operation/DepthwiseConv2D.h | 1 + .../core/include/model/operation/Dequantize.h | 1 + runtime/neurun/core/include/model/operation/Div.h | 1 + .../core/include/model/operation/EmbeddingLookup.h | 1 + runtime/neurun/core/include/model/operation/Exp.h | 1 + .../neurun/core/include/model/operation/Floor.h | 1 + .../core/include/model/operation/FullyConnected.h | 1 + .../neurun/core/include/model/operation/Gather.h | 1 + .../core/include/model/operation/HashtableLookup.h | 1 + .../core/include/model/operation/InstanceNorm.h | 1 + .../core/include/model/operation/L2Normalization.h | 1 + .../neurun/core/include/model/operation/L2Pool2D.h | 1 + runtime/neurun/core/include/model/operation/LSTM.h | 1 + .../model/operation/LocalResponseNormalization.h | 1 + .../core/include/model/operation/LogicalAnd.h | 1 + .../core/include/model/operation/LogicalNot.h | 1 + .../core/include/model/operation/LogicalOr.h | 1 + .../neurun/core/include/model/operation/Logistic.h | 1 + .../core/include/model/operation/MaxPool2D.h | 1 + runtime/neurun/core/include/model/operation/Mean.h | 1 + runtime/neurun/core/include/model/operation/Mul.h | 1 + runtime/neurun/core/include/model/operation/Neg.h | 1 + .../neurun/core/include/model/operation/PReLU.h | 1 + runtime/neurun/core/include/model/operation/Pack.h | 1 + runtime/neurun/core/include/model/operation/Pad.h | 1 + .../neurun/core/include/model/operation/Permute.h | 1 + runtime/neurun/core/include/model/operation/RNN.h | 1 + .../neurun/core/include/model/operation/RSQRT.h | 1 + runtime/neurun/core/include/model/operation/ReLU.h | 1 + .../neurun/core/include/model/operation/ReLU1.h | 1 + .../neurun/core/include/model/operation/ReLU6.h | 1 + .../core/include/model/operation/ReduceMax.h | 1 + .../core/include/model/operation/ReduceMin.h | 1 + .../core/include/model/operation/ReduceSum.h | 1 + .../neurun/core/include/model/operation/Reshape.h | 1 + .../core/include/model/operation/ResizeBilinear.h | 1 + runtime/neurun/core/include/model/operation/SQRT.h | 1 + .../neurun/core/include/model/operation/Softmax.h | 1 + .../core/include/model/operation/SpaceToBatchND.h | 1 + .../core/include/model/operation/SpaceToDepth.h | 1 + .../neurun/core/include/model/operation/Split.h | 1 + .../include/model/operation/SquaredDifference.h | 1 + .../neurun/core/include/model/operation/Squeeze.h | 1 + .../core/include/model/operation/StridedSlice.h | 1 + runtime/neurun/core/include/model/operation/Sub.h | 1 + runtime/neurun/core/include/model/operation/Tanh.h | 1 + .../neurun/core/include/model/operation/TopKV2.h | 1 + .../core/include/model/operation/Transpose.h | 1 + .../core/include/model/operation/TransposeConv.h | 1 + .../neurun/core/include/model/operation/Unpack.h | 1 + runtime/neurun/test/graph/MockNode.h | 1 + 65 files changed, 105 insertions(+) create mode 100644 runtime/neurun/core/include/model/OpCode.h diff --git a/runtime/neurun/core/include/model/OpCode.h b/runtime/neurun/core/include/model/OpCode.h new file mode 100644 index 0000000..32a8f9e --- /dev/null +++ b/runtime/neurun/core/include/model/OpCode.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 __NEURUN_MODEL_OP_CODE_H__ +#define __NEURUN_MODEL_OP_CODE_H__ + +#include + +namespace neurun +{ +namespace model +{ + +enum class OpCode +{ + Invalid, //< Unused +#define OP(Name) Name, //< All operations +#include "Operations.lst" +#undef OP + Subgraph, //< Subgraph is treated specially + COUNT +}; + +} // namespace model +} // namespace neurun + +#endif // __NEURUN_MODEL_OP_CODE_H__ diff --git a/runtime/neurun/core/include/model/Operation.h b/runtime/neurun/core/include/model/Operation.h index c829f35..b206879 100644 --- a/runtime/neurun/core/include/model/Operation.h +++ b/runtime/neurun/core/include/model/Operation.h @@ -19,6 +19,7 @@ #include +#include "model/OpCode.h" #include "model/Operand.h" #include "model/OperandIndexSequence.h" #include "model/OperandConstraint.h" @@ -55,6 +56,7 @@ public: public: virtual void accept(OperationVisitor &v) const = 0; virtual std::string name() const = 0; + virtual OpCode opcode() const = 0; public: void replaceInput(const OperandIndex &from, const OperandIndex &to); diff --git a/runtime/neurun/core/include/model/Subgraph.h b/runtime/neurun/core/include/model/Subgraph.h index bf3f059..b9061db 100644 --- a/runtime/neurun/core/include/model/Subgraph.h +++ b/runtime/neurun/core/include/model/Subgraph.h @@ -54,6 +54,7 @@ public: void accept(OperationVisitor &v) const override; virtual std::string name(void) const override { return "Subgraph"; } + OpCode opcode(void) const final { return OpCode::Subgraph; } public: void appendOperation(const OperationIndex &index, const Operation &node) diff --git a/runtime/neurun/core/include/model/operation/Abs.h b/runtime/neurun/core/include/model/operation/Abs.h index 40f635f..07baa4e 100644 --- a/runtime/neurun/core/include/model/operation/Abs.h +++ b/runtime/neurun/core/include/model/operation/Abs.h @@ -40,6 +40,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Abs"; } + OpCode opcode() const final { return OpCode::Abs; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/Add.h b/runtime/neurun/core/include/model/operation/Add.h index fc3403d..4f0b575 100644 --- a/runtime/neurun/core/include/model/operation/Add.h +++ b/runtime/neurun/core/include/model/operation/Add.h @@ -47,6 +47,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Add"; } + OpCode opcode() const final { return OpCode::Add; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/ArgMax.h b/runtime/neurun/core/include/model/operation/ArgMax.h index b9ad508..ac25a0d 100644 --- a/runtime/neurun/core/include/model/operation/ArgMax.h +++ b/runtime/neurun/core/include/model/operation/ArgMax.h @@ -46,6 +46,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "ArgMax"; } + OpCode opcode() const final { return OpCode::ArgMax; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/AvgPool2D.h b/runtime/neurun/core/include/model/operation/AvgPool2D.h index 860b019..b7af571 100644 --- a/runtime/neurun/core/include/model/operation/AvgPool2D.h +++ b/runtime/neurun/core/include/model/operation/AvgPool2D.h @@ -54,6 +54,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "AvgPool2D"; } + OpCode opcode() const final { return OpCode::AvgPool2D; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/BatchToSpaceND.h b/runtime/neurun/core/include/model/operation/BatchToSpaceND.h index 80e9488..5e9c296 100644 --- a/runtime/neurun/core/include/model/operation/BatchToSpaceND.h +++ b/runtime/neurun/core/include/model/operation/BatchToSpaceND.h @@ -41,6 +41,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "BatchToSpaceND"; } + OpCode opcode() const final { return OpCode::BatchToSpaceND; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/Cast.h b/runtime/neurun/core/include/model/operation/Cast.h index 215da97..3d112bb 100644 --- a/runtime/neurun/core/include/model/operation/Cast.h +++ b/runtime/neurun/core/include/model/operation/Cast.h @@ -40,6 +40,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Cast"; } + OpCode opcode() const final { return OpCode::Cast; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/Comparison.h b/runtime/neurun/core/include/model/operation/Comparison.h index 57d1f07..4b04291 100644 --- a/runtime/neurun/core/include/model/operation/Comparison.h +++ b/runtime/neurun/core/include/model/operation/Comparison.h @@ -57,6 +57,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Comparison"; } + OpCode opcode() const final { return OpCode::Comparison; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/Concat.h b/runtime/neurun/core/include/model/operation/Concat.h index 44b93f3..864c036 100644 --- a/runtime/neurun/core/include/model/operation/Concat.h +++ b/runtime/neurun/core/include/model/operation/Concat.h @@ -43,6 +43,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Concat"; } + OpCode opcode() const final { return OpCode::Concat; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/Conv2D.h b/runtime/neurun/core/include/model/operation/Conv2D.h index 1a54342..256bf68 100644 --- a/runtime/neurun/core/include/model/operation/Conv2D.h +++ b/runtime/neurun/core/include/model/operation/Conv2D.h @@ -53,6 +53,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Conv2D"; } + OpCode opcode() const final { return OpCode::Conv2D; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/Custom.h b/runtime/neurun/core/include/model/operation/Custom.h index 6bab1f7..eadae20 100644 --- a/runtime/neurun/core/include/model/operation/Custom.h +++ b/runtime/neurun/core/include/model/operation/Custom.h @@ -46,6 +46,7 @@ public: const std::string &id() const; std::string name() const override; + OpCode opcode() const final { return OpCode::Custom; } /** * @return user-provided data diff --git a/runtime/neurun/core/include/model/operation/DepthToSpace.h b/runtime/neurun/core/include/model/operation/DepthToSpace.h index 57c8343..d0609da 100644 --- a/runtime/neurun/core/include/model/operation/DepthToSpace.h +++ b/runtime/neurun/core/include/model/operation/DepthToSpace.h @@ -48,6 +48,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "DepthToSpace"; } + OpCode opcode() const final { return OpCode::DepthToSpace; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/DepthwiseConv2D.h b/runtime/neurun/core/include/model/operation/DepthwiseConv2D.h index 4d135bc..519c59b 100644 --- a/runtime/neurun/core/include/model/operation/DepthwiseConv2D.h +++ b/runtime/neurun/core/include/model/operation/DepthwiseConv2D.h @@ -54,6 +54,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "DepthwiseConv2D"; } + OpCode opcode() const final { return OpCode::DepthwiseConv2D; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/Dequantize.h b/runtime/neurun/core/include/model/operation/Dequantize.h index 9ab7b4c..76dc776 100644 --- a/runtime/neurun/core/include/model/operation/Dequantize.h +++ b/runtime/neurun/core/include/model/operation/Dequantize.h @@ -40,6 +40,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Dequantize"; } + OpCode opcode() const final { return OpCode::Dequantize; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/Div.h b/runtime/neurun/core/include/model/operation/Div.h index 5e17a6f..fb76efa 100644 --- a/runtime/neurun/core/include/model/operation/Div.h +++ b/runtime/neurun/core/include/model/operation/Div.h @@ -47,6 +47,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Div"; } + OpCode opcode() const final { return OpCode::Div; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/EmbeddingLookup.h b/runtime/neurun/core/include/model/operation/EmbeddingLookup.h index 732d1b7..2f159fe 100644 --- a/runtime/neurun/core/include/model/operation/EmbeddingLookup.h +++ b/runtime/neurun/core/include/model/operation/EmbeddingLookup.h @@ -41,6 +41,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "EmbeddingLookup"; } + OpCode opcode() const final { return OpCode::EmbeddingLookup; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/Exp.h b/runtime/neurun/core/include/model/operation/Exp.h index 077c57a..b314734 100644 --- a/runtime/neurun/core/include/model/operation/Exp.h +++ b/runtime/neurun/core/include/model/operation/Exp.h @@ -40,6 +40,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Exp"; } + OpCode opcode() const final { return OpCode::Exp; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/Floor.h b/runtime/neurun/core/include/model/operation/Floor.h index 83b851a..2e69c75 100644 --- a/runtime/neurun/core/include/model/operation/Floor.h +++ b/runtime/neurun/core/include/model/operation/Floor.h @@ -42,6 +42,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Floor"; } + OpCode opcode() const final { return OpCode::Floor; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/FullyConnected.h b/runtime/neurun/core/include/model/operation/FullyConnected.h index 285cfb5..d75c0c8 100644 --- a/runtime/neurun/core/include/model/operation/FullyConnected.h +++ b/runtime/neurun/core/include/model/operation/FullyConnected.h @@ -51,6 +51,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "FullyConnected"; } + OpCode opcode() const final { return OpCode::FullyConnected; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/Gather.h b/runtime/neurun/core/include/model/operation/Gather.h index 0f19157..0f73d83 100644 --- a/runtime/neurun/core/include/model/operation/Gather.h +++ b/runtime/neurun/core/include/model/operation/Gather.h @@ -49,6 +49,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Gather"; } + OpCode opcode() const final { return OpCode::Gather; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/HashtableLookup.h b/runtime/neurun/core/include/model/operation/HashtableLookup.h index a8f5606..4eb0314 100644 --- a/runtime/neurun/core/include/model/operation/HashtableLookup.h +++ b/runtime/neurun/core/include/model/operation/HashtableLookup.h @@ -48,6 +48,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "HashTableLookup"; } + OpCode opcode() const final { return OpCode::HashtableLookup; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/InstanceNorm.h b/runtime/neurun/core/include/model/operation/InstanceNorm.h index 2370b61..b19f73b 100644 --- a/runtime/neurun/core/include/model/operation/InstanceNorm.h +++ b/runtime/neurun/core/include/model/operation/InstanceNorm.h @@ -50,6 +50,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "InstanceNorm"; } + OpCode opcode() const final { return OpCode::InstanceNorm; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/L2Normalization.h b/runtime/neurun/core/include/model/operation/L2Normalization.h index b51336b..273874a 100644 --- a/runtime/neurun/core/include/model/operation/L2Normalization.h +++ b/runtime/neurun/core/include/model/operation/L2Normalization.h @@ -40,6 +40,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "L2Normalization"; } + OpCode opcode() const final { return OpCode::L2Normalization; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/L2Pool2D.h b/runtime/neurun/core/include/model/operation/L2Pool2D.h index 50d2e21..0415c96 100644 --- a/runtime/neurun/core/include/model/operation/L2Pool2D.h +++ b/runtime/neurun/core/include/model/operation/L2Pool2D.h @@ -53,6 +53,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "L2Pool2D"; } + OpCode opcode() const final { return OpCode::L2Pool2D; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/LSTM.h b/runtime/neurun/core/include/model/operation/LSTM.h index e97fe12..ce28851 100644 --- a/runtime/neurun/core/include/model/operation/LSTM.h +++ b/runtime/neurun/core/include/model/operation/LSTM.h @@ -74,6 +74,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "LSTM"; } + OpCode opcode() const final { return OpCode::LSTM; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/LocalResponseNormalization.h b/runtime/neurun/core/include/model/operation/LocalResponseNormalization.h index a906316..998b11d 100644 --- a/runtime/neurun/core/include/model/operation/LocalResponseNormalization.h +++ b/runtime/neurun/core/include/model/operation/LocalResponseNormalization.h @@ -51,6 +51,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "LocalResponseNormalization"; } + OpCode opcode() const final { return OpCode::LocalResponseNormalization; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/LogicalAnd.h b/runtime/neurun/core/include/model/operation/LogicalAnd.h index ce7b8da..c88364b 100644 --- a/runtime/neurun/core/include/model/operation/LogicalAnd.h +++ b/runtime/neurun/core/include/model/operation/LogicalAnd.h @@ -41,6 +41,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "LogicalAnd"; } + OpCode opcode() const final { return OpCode::LogicalAnd; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/LogicalNot.h b/runtime/neurun/core/include/model/operation/LogicalNot.h index 301edd8..8caf75b 100644 --- a/runtime/neurun/core/include/model/operation/LogicalNot.h +++ b/runtime/neurun/core/include/model/operation/LogicalNot.h @@ -40,6 +40,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "LogicalNot"; } + OpCode opcode() const final { return OpCode::LogicalNot; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/LogicalOr.h b/runtime/neurun/core/include/model/operation/LogicalOr.h index a15ae97..21082eb 100644 --- a/runtime/neurun/core/include/model/operation/LogicalOr.h +++ b/runtime/neurun/core/include/model/operation/LogicalOr.h @@ -41,6 +41,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "LogicalOr"; } + OpCode opcode() const final { return OpCode::LogicalOr; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/Logistic.h b/runtime/neurun/core/include/model/operation/Logistic.h index 68cd1aa..756a963 100644 --- a/runtime/neurun/core/include/model/operation/Logistic.h +++ b/runtime/neurun/core/include/model/operation/Logistic.h @@ -40,6 +40,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Logistic"; } + OpCode opcode() const final { return OpCode::Logistic; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/MaxPool2D.h b/runtime/neurun/core/include/model/operation/MaxPool2D.h index 4388788..c793a7b 100644 --- a/runtime/neurun/core/include/model/operation/MaxPool2D.h +++ b/runtime/neurun/core/include/model/operation/MaxPool2D.h @@ -53,6 +53,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "MaxPool2D"; } + OpCode opcode() const final { return OpCode::MaxPool2D; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/Mean.h b/runtime/neurun/core/include/model/operation/Mean.h index 22c2e50..ed8a3d5 100644 --- a/runtime/neurun/core/include/model/operation/Mean.h +++ b/runtime/neurun/core/include/model/operation/Mean.h @@ -46,6 +46,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Mean"; } + OpCode opcode() const final { return OpCode::Mean; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/Mul.h b/runtime/neurun/core/include/model/operation/Mul.h index 0675988..c41f175 100644 --- a/runtime/neurun/core/include/model/operation/Mul.h +++ b/runtime/neurun/core/include/model/operation/Mul.h @@ -47,6 +47,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Mul"; } + OpCode opcode() const final { return OpCode::Mul; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/Neg.h b/runtime/neurun/core/include/model/operation/Neg.h index 401414d..6bc7111 100644 --- a/runtime/neurun/core/include/model/operation/Neg.h +++ b/runtime/neurun/core/include/model/operation/Neg.h @@ -40,6 +40,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Neg"; } + OpCode opcode() const final { return OpCode::Neg; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/PReLU.h b/runtime/neurun/core/include/model/operation/PReLU.h index 76a76ac..26bb8f3 100644 --- a/runtime/neurun/core/include/model/operation/PReLU.h +++ b/runtime/neurun/core/include/model/operation/PReLU.h @@ -41,6 +41,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "PReLU"; } + OpCode opcode() const final { return OpCode::PReLU; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/Pack.h b/runtime/neurun/core/include/model/operation/Pack.h index ce7ff7f..94683fb 100644 --- a/runtime/neurun/core/include/model/operation/Pack.h +++ b/runtime/neurun/core/include/model/operation/Pack.h @@ -39,6 +39,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Pack"; } + OpCode opcode() const final { return OpCode::Pack; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/Pad.h b/runtime/neurun/core/include/model/operation/Pad.h index 7594098..07eec7b 100644 --- a/runtime/neurun/core/include/model/operation/Pad.h +++ b/runtime/neurun/core/include/model/operation/Pad.h @@ -42,6 +42,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Pad"; } + OpCode opcode() const final { return OpCode::Pad; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/Permute.h b/runtime/neurun/core/include/model/operation/Permute.h index 2ba4665..33a58ca 100644 --- a/runtime/neurun/core/include/model/operation/Permute.h +++ b/runtime/neurun/core/include/model/operation/Permute.h @@ -53,6 +53,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Permute"; } + OpCode opcode() const final { return OpCode::Permute; } public: Permute(const OperandIndex &input, const OperandIndex &output, diff --git a/runtime/neurun/core/include/model/operation/RNN.h b/runtime/neurun/core/include/model/operation/RNN.h index 1b7ec89..8ec76e4 100644 --- a/runtime/neurun/core/include/model/operation/RNN.h +++ b/runtime/neurun/core/include/model/operation/RNN.h @@ -55,6 +55,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "RNN"; } + OpCode opcode() const final { return OpCode::RNN; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/RSQRT.h b/runtime/neurun/core/include/model/operation/RSQRT.h index 243fe94..02616ba 100644 --- a/runtime/neurun/core/include/model/operation/RSQRT.h +++ b/runtime/neurun/core/include/model/operation/RSQRT.h @@ -40,6 +40,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "RSQRT"; } + OpCode opcode() const final { return OpCode::RSQRT; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/ReLU.h b/runtime/neurun/core/include/model/operation/ReLU.h index 6d7cbd5..287c8ee 100644 --- a/runtime/neurun/core/include/model/operation/ReLU.h +++ b/runtime/neurun/core/include/model/operation/ReLU.h @@ -40,6 +40,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "ReLU"; } + OpCode opcode() const final { return OpCode::ReLU; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/ReLU1.h b/runtime/neurun/core/include/model/operation/ReLU1.h index b28bab1..bab3847 100644 --- a/runtime/neurun/core/include/model/operation/ReLU1.h +++ b/runtime/neurun/core/include/model/operation/ReLU1.h @@ -40,6 +40,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "ReLU1"; } + OpCode opcode() const final { return OpCode::ReLU1; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/ReLU6.h b/runtime/neurun/core/include/model/operation/ReLU6.h index 9bf9eb1..f3cdf93 100644 --- a/runtime/neurun/core/include/model/operation/ReLU6.h +++ b/runtime/neurun/core/include/model/operation/ReLU6.h @@ -40,6 +40,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "ReLU6"; } + OpCode opcode() const final { return OpCode::ReLU6; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/ReduceMax.h b/runtime/neurun/core/include/model/operation/ReduceMax.h index bb52fcb..6361902 100644 --- a/runtime/neurun/core/include/model/operation/ReduceMax.h +++ b/runtime/neurun/core/include/model/operation/ReduceMax.h @@ -48,6 +48,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "ReduceMax"; } + OpCode opcode() const final { return OpCode::ReduceMax; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/ReduceMin.h b/runtime/neurun/core/include/model/operation/ReduceMin.h index 7bbeb88..7c25c2d 100644 --- a/runtime/neurun/core/include/model/operation/ReduceMin.h +++ b/runtime/neurun/core/include/model/operation/ReduceMin.h @@ -48,6 +48,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "ReduceMin"; } + OpCode opcode() const final { return OpCode::ReduceMin; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/ReduceSum.h b/runtime/neurun/core/include/model/operation/ReduceSum.h index f3162d6..26ce58f 100644 --- a/runtime/neurun/core/include/model/operation/ReduceSum.h +++ b/runtime/neurun/core/include/model/operation/ReduceSum.h @@ -46,6 +46,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "ReduceSum"; } + OpCode opcode() const final { return OpCode::ReduceSum; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/Reshape.h b/runtime/neurun/core/include/model/operation/Reshape.h index d32789e..3a9c01f 100644 --- a/runtime/neurun/core/include/model/operation/Reshape.h +++ b/runtime/neurun/core/include/model/operation/Reshape.h @@ -42,6 +42,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Reshape"; } + OpCode opcode() const final { return OpCode::Reshape; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/ResizeBilinear.h b/runtime/neurun/core/include/model/operation/ResizeBilinear.h index 685d1e1..1ac9aaf 100644 --- a/runtime/neurun/core/include/model/operation/ResizeBilinear.h +++ b/runtime/neurun/core/include/model/operation/ResizeBilinear.h @@ -49,6 +49,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "ResizeBilinear"; } + OpCode opcode() const final { return OpCode::ResizeBilinear; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/SQRT.h b/runtime/neurun/core/include/model/operation/SQRT.h index bd97397..4a2ece8 100644 --- a/runtime/neurun/core/include/model/operation/SQRT.h +++ b/runtime/neurun/core/include/model/operation/SQRT.h @@ -40,6 +40,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "SQRT"; } + OpCode opcode() const final { return OpCode::SQRT; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/Softmax.h b/runtime/neurun/core/include/model/operation/Softmax.h index af4fc99..a6bc228 100644 --- a/runtime/neurun/core/include/model/operation/Softmax.h +++ b/runtime/neurun/core/include/model/operation/Softmax.h @@ -48,6 +48,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "SoftMax"; } + OpCode opcode() const final { return OpCode::Softmax; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/SpaceToBatchND.h b/runtime/neurun/core/include/model/operation/SpaceToBatchND.h index 63ed2c7..79218c1 100644 --- a/runtime/neurun/core/include/model/operation/SpaceToBatchND.h +++ b/runtime/neurun/core/include/model/operation/SpaceToBatchND.h @@ -44,6 +44,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "SpaceToBatchND"; } + OpCode opcode() const final { return OpCode::SpaceToBatchND; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/SpaceToDepth.h b/runtime/neurun/core/include/model/operation/SpaceToDepth.h index c28517b..0b63260 100644 --- a/runtime/neurun/core/include/model/operation/SpaceToDepth.h +++ b/runtime/neurun/core/include/model/operation/SpaceToDepth.h @@ -48,6 +48,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "SpaceToDepth"; } + OpCode opcode() const final { return OpCode::SpaceToDepth; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/Split.h b/runtime/neurun/core/include/model/operation/Split.h index b6d5929..ca96546 100644 --- a/runtime/neurun/core/include/model/operation/Split.h +++ b/runtime/neurun/core/include/model/operation/Split.h @@ -45,6 +45,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Split"; } + OpCode opcode() const final { return OpCode::Split; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/SquaredDifference.h b/runtime/neurun/core/include/model/operation/SquaredDifference.h index 85ccb47..352e924 100644 --- a/runtime/neurun/core/include/model/operation/SquaredDifference.h +++ b/runtime/neurun/core/include/model/operation/SquaredDifference.h @@ -41,6 +41,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "SquaredDifference"; } + OpCode opcode() const final { return OpCode::SquaredDifference; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/Squeeze.h b/runtime/neurun/core/include/model/operation/Squeeze.h index 0d2a238..e719ce9 100644 --- a/runtime/neurun/core/include/model/operation/Squeeze.h +++ b/runtime/neurun/core/include/model/operation/Squeeze.h @@ -49,6 +49,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Squeeze"; } + OpCode opcode() const final { return OpCode::Squeeze; } const Param ¶m() const { return _param; } private: diff --git a/runtime/neurun/core/include/model/operation/StridedSlice.h b/runtime/neurun/core/include/model/operation/StridedSlice.h index 8cb9a52..13f1398 100644 --- a/runtime/neurun/core/include/model/operation/StridedSlice.h +++ b/runtime/neurun/core/include/model/operation/StridedSlice.h @@ -53,6 +53,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "StridedSlice"; } + OpCode opcode() const final { return OpCode::StridedSlice; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/Sub.h b/runtime/neurun/core/include/model/operation/Sub.h index 6fc4b92..931f5e0 100644 --- a/runtime/neurun/core/include/model/operation/Sub.h +++ b/runtime/neurun/core/include/model/operation/Sub.h @@ -47,6 +47,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Sub"; } + OpCode opcode() const final { return OpCode::Sub; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/Tanh.h b/runtime/neurun/core/include/model/operation/Tanh.h index 313c6b7..4458d19 100644 --- a/runtime/neurun/core/include/model/operation/Tanh.h +++ b/runtime/neurun/core/include/model/operation/Tanh.h @@ -40,6 +40,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Tanh"; } + OpCode opcode() const final { return OpCode::Tanh; } }; } // namespace operation diff --git a/runtime/neurun/core/include/model/operation/TopKV2.h b/runtime/neurun/core/include/model/operation/TopKV2.h index f36a491..2145df7 100644 --- a/runtime/neurun/core/include/model/operation/TopKV2.h +++ b/runtime/neurun/core/include/model/operation/TopKV2.h @@ -54,6 +54,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "TopKV2"; } + OpCode opcode() const final { return OpCode::TopKV2; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/Transpose.h b/runtime/neurun/core/include/model/operation/Transpose.h index ff32686..ef661c9 100644 --- a/runtime/neurun/core/include/model/operation/Transpose.h +++ b/runtime/neurun/core/include/model/operation/Transpose.h @@ -51,6 +51,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Transpose"; } + OpCode opcode() const final { return OpCode::Transpose; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/TransposeConv.h b/runtime/neurun/core/include/model/operation/TransposeConv.h index b59df06..9c9ea84 100644 --- a/runtime/neurun/core/include/model/operation/TransposeConv.h +++ b/runtime/neurun/core/include/model/operation/TransposeConv.h @@ -52,6 +52,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "TransposeConv"; } + OpCode opcode() const final { return OpCode::TransposeConv; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/core/include/model/operation/Unpack.h b/runtime/neurun/core/include/model/operation/Unpack.h index a1ece87..55e76b6 100644 --- a/runtime/neurun/core/include/model/operation/Unpack.h +++ b/runtime/neurun/core/include/model/operation/Unpack.h @@ -45,6 +45,7 @@ public: public: void accept(OperationVisitor &v) const override; std::string name() const override { return "Unpack"; } + OpCode opcode() const final { return OpCode::Unpack; } public: const Param ¶m() const { return _param; } diff --git a/runtime/neurun/test/graph/MockNode.h b/runtime/neurun/test/graph/MockNode.h index b0b8b71..fbb01d3 100644 --- a/runtime/neurun/test/graph/MockNode.h +++ b/runtime/neurun/test/graph/MockNode.h @@ -39,6 +39,7 @@ public: public: void accept(neurun::model::OperationVisitor &) const override {} std::string name() const override { return "SimpleMock"; } + neurun::model::OpCode opcode() const final { return neurun::model::OpCode::Invalid; } }; } // namespace graph -- 2.7.4