From 6564dac806456acdad82032476220a748b8ba426 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9D=B4=ED=95=9C=EC=A2=85/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Engineer/=EC=82=BC=EC=84=B1=EC=A0=84?= =?utf8?q?=EC=9E=90?= Date: Thu, 30 Aug 2018 10:02:46 +0900 Subject: [PATCH] [neurun] Remove internal::op nodes (#2519) Remove Nodes in the namespace internal::op and some classes related to those nodes. Signed-off-by: Hanjoung Lee --- runtimes/neurun/src/backend/ITensorBuilder.h | 16 ----- .../neurun/src/backend/acl_cl/StageGenerator.cc | 1 - runtimes/neurun/src/codegen/IPlanBuilder.h | 1 - runtimes/neurun/src/codegen/Planner.cc | 1 - runtimes/neurun/src/compilation.cc | 1 - runtimes/neurun/src/graph/operation/Concat.h | 1 - runtimes/neurun/src/graph/operation/Conv2D.h | 1 - .../neurun/src/graph/operation/FullyConnected.h | 1 - runtimes/neurun/src/graph/operation/MaxPool2D.h | 1 - runtimes/neurun/src/graph/operation/NOP.h | 1 - runtimes/neurun/src/graph/operation/Node.h | 1 - runtimes/neurun/src/graph/operation/Reshape.h | 1 - runtimes/neurun/src/graph/operation/Set.cc | 2 + runtimes/neurun/src/graph/operation/Set.h | 1 - runtimes/neurun/src/graph/operation/Softmax.h | 1 - runtimes/neurun/src/internal/Convert.h | 3 +- runtimes/neurun/src/internal/Model.h | 75 ---------------------- runtimes/neurun/src/internal/op/AvgPool2D.cc | 65 ------------------- runtimes/neurun/src/internal/op/AvgPool2D.h | 66 ------------------- runtimes/neurun/src/internal/op/Concat.cc | 53 --------------- runtimes/neurun/src/internal/op/Concat.h | 56 ---------------- runtimes/neurun/src/internal/op/Conv2D.cc | 66 ------------------- runtimes/neurun/src/internal/op/Conv2D.h | 65 ------------------- runtimes/neurun/src/internal/op/FullyConnected.cc | 53 --------------- runtimes/neurun/src/internal/op/FullyConnected.h | 57 ---------------- runtimes/neurun/src/internal/op/MaxPool2D.cc | 65 ------------------- runtimes/neurun/src/internal/op/MaxPool2D.h | 66 ------------------- runtimes/neurun/src/internal/op/NOP.cc | 37 ----------- runtimes/neurun/src/internal/op/NOP.h | 55 ---------------- runtimes/neurun/src/internal/op/Node.h | 24 ------- runtimes/neurun/src/internal/op/NodeVisitor.h | 38 ----------- runtimes/neurun/src/internal/op/Reshape.cc | 50 --------------- runtimes/neurun/src/internal/op/Reshape.h | 55 ---------------- runtimes/neurun/src/internal/op/Softmax.cc | 49 -------------- runtimes/neurun/src/internal/op/Softmax.h | 55 ---------------- runtimes/neurun/src/kernel/acl_cl/ConcatLayer.h | 2 - runtimes/neurun/src/kernel/cpu/AvgPoolLayer.h | 1 - runtimes/neurun/src/kernel/cpu/ConcatLayer.h | 1 - runtimes/neurun/src/kernel/cpu/ConvolutionLayer.h | 1 - .../neurun/src/kernel/cpu/FullyConnectedLayer.h | 1 - runtimes/neurun/src/kernel/cpu/MaxPoolLayer.h | 1 - runtimes/neurun/src/kernel/cpu/OperationUtils.h | 2 +- runtimes/neurun/src/kernel/cpu/ReshapeLayer.h | 1 - runtimes/neurun/src/kernel/cpu/SoftMaxLayer.h | 1 - runtimes/neurun/src/linear/Linear.cc | 1 - 45 files changed, 5 insertions(+), 1091 deletions(-) delete mode 100644 runtimes/neurun/src/internal/Model.h delete mode 100644 runtimes/neurun/src/internal/op/AvgPool2D.cc delete mode 100644 runtimes/neurun/src/internal/op/AvgPool2D.h delete mode 100644 runtimes/neurun/src/internal/op/Concat.cc delete mode 100644 runtimes/neurun/src/internal/op/Concat.h delete mode 100644 runtimes/neurun/src/internal/op/Conv2D.cc delete mode 100644 runtimes/neurun/src/internal/op/Conv2D.h delete mode 100644 runtimes/neurun/src/internal/op/FullyConnected.cc delete mode 100644 runtimes/neurun/src/internal/op/FullyConnected.h delete mode 100644 runtimes/neurun/src/internal/op/MaxPool2D.cc delete mode 100644 runtimes/neurun/src/internal/op/MaxPool2D.h delete mode 100644 runtimes/neurun/src/internal/op/NOP.cc delete mode 100644 runtimes/neurun/src/internal/op/NOP.h delete mode 100644 runtimes/neurun/src/internal/op/Node.h delete mode 100644 runtimes/neurun/src/internal/op/NodeVisitor.h delete mode 100644 runtimes/neurun/src/internal/op/Reshape.cc delete mode 100644 runtimes/neurun/src/internal/op/Reshape.h delete mode 100644 runtimes/neurun/src/internal/op/Softmax.cc delete mode 100644 runtimes/neurun/src/internal/op/Softmax.h diff --git a/runtimes/neurun/src/backend/ITensorBuilder.h b/runtimes/neurun/src/backend/ITensorBuilder.h index b0239b4..e67fe06 100644 --- a/runtimes/neurun/src/backend/ITensorBuilder.h +++ b/runtimes/neurun/src/backend/ITensorBuilder.h @@ -4,7 +4,6 @@ #include #include -#include "internal/Model.h" #include "graph/operand/Index.h" namespace neurun @@ -12,17 +11,6 @@ namespace neurun namespace backend { -struct TensorConversionParam -{ - TensorConversionParam(const ::internal::tflite::op::Node &op, int tensor_index) - : op(op), tensor_index(tensor_index) - { - } - - const ::internal::tflite::op::Node &op; - int tensor_index; -}; - struct ITensorBuilder { virtual ~ITensorBuilder(void) = default; @@ -30,10 +18,6 @@ struct ITensorBuilder // TODO Add an interface for adding subsumption info virtual void prepare(const std::map &tensor_info_ctx) = 0; virtual void allocate(void) = 0; - -protected: - std::vector _from_common_candidates; - std::vector _to_common_candidates; }; } // namespace backend diff --git a/runtimes/neurun/src/backend/acl_cl/StageGenerator.cc b/runtimes/neurun/src/backend/acl_cl/StageGenerator.cc index b259578..1471674 100644 --- a/runtimes/neurun/src/backend/acl_cl/StageGenerator.cc +++ b/runtimes/neurun/src/backend/acl_cl/StageGenerator.cc @@ -12,7 +12,6 @@ #include "kernel/acl_cl/TensorConvertToCommonLayer.h" #include "internal/Padding.h" -#include "internal/Model.h" #include "graph/operand/Index.h" diff --git a/runtimes/neurun/src/codegen/IPlanBuilder.h b/runtimes/neurun/src/codegen/IPlanBuilder.h index ba2d790..fc9cc36 100644 --- a/runtimes/neurun/src/codegen/IPlanBuilder.h +++ b/runtimes/neurun/src/codegen/IPlanBuilder.h @@ -2,7 +2,6 @@ #define __NEURUN_CODEGEN_I_PLAN_BUILDER_H__ #include "arm_compute/core/TensorInfo.h" -#include "internal/Model.h" #include "backend/IStageGenerator.h" #include "backend/IInitializerGenerator.h" diff --git a/runtimes/neurun/src/codegen/Planner.cc b/runtimes/neurun/src/codegen/Planner.cc index b569ad5..526b5b6 100644 --- a/runtimes/neurun/src/codegen/Planner.cc +++ b/runtimes/neurun/src/codegen/Planner.cc @@ -3,7 +3,6 @@ #include #include "internal/Convert.h" -#include "internal/Model.h" #include "graph/operand/Set.h" #include "codegen/IPlanBuilder.h" #include "codegen/BackendResolver.h" diff --git a/runtimes/neurun/src/compilation.cc b/runtimes/neurun/src/compilation.cc index 1734093..014a4b4 100644 --- a/runtimes/neurun/src/compilation.cc +++ b/runtimes/neurun/src/compilation.cc @@ -11,7 +11,6 @@ #include "backend/acl_cl/kernel/View.h" #include "backend/acl_cl/TensorBuilder.h" #include "internal/nnapi/kernel/Reader.h" -#include "internal/Model.h" #include "internal/Padding.h" #include "backend/IInitializerGenerator.h" #include "backend/IStageGenerator.h" diff --git a/runtimes/neurun/src/graph/operation/Concat.h b/runtimes/neurun/src/graph/operation/Concat.h index 2821049..6dee914 100644 --- a/runtimes/neurun/src/graph/operation/Concat.h +++ b/runtimes/neurun/src/graph/operation/Concat.h @@ -4,7 +4,6 @@ #include #include "graph/operation/Node.h" -#include "internal/op/Concat.h" namespace neurun { diff --git a/runtimes/neurun/src/graph/operation/Conv2D.h b/runtimes/neurun/src/graph/operation/Conv2D.h index 01b3d82..c78a1c1 100644 --- a/runtimes/neurun/src/graph/operation/Conv2D.h +++ b/runtimes/neurun/src/graph/operation/Conv2D.h @@ -4,7 +4,6 @@ #include #include "graph/operation/Node.h" -#include "internal/op/Conv2D.h" namespace neurun { diff --git a/runtimes/neurun/src/graph/operation/FullyConnected.h b/runtimes/neurun/src/graph/operation/FullyConnected.h index 37cf44a..445753c 100644 --- a/runtimes/neurun/src/graph/operation/FullyConnected.h +++ b/runtimes/neurun/src/graph/operation/FullyConnected.h @@ -4,7 +4,6 @@ #include #include "graph/operation/Node.h" -#include "internal/op/FullyConnected.h" namespace neurun { diff --git a/runtimes/neurun/src/graph/operation/MaxPool2D.h b/runtimes/neurun/src/graph/operation/MaxPool2D.h index 11fe33a..96c2f23 100644 --- a/runtimes/neurun/src/graph/operation/MaxPool2D.h +++ b/runtimes/neurun/src/graph/operation/MaxPool2D.h @@ -4,7 +4,6 @@ #include #include "graph/operation/Node.h" -#include "internal/op/MaxPool2D.h" namespace neurun { diff --git a/runtimes/neurun/src/graph/operation/NOP.h b/runtimes/neurun/src/graph/operation/NOP.h index 1f861f2..c14e43d 100644 --- a/runtimes/neurun/src/graph/operation/NOP.h +++ b/runtimes/neurun/src/graph/operation/NOP.h @@ -4,7 +4,6 @@ #include #include "graph/operation/Node.h" -#include "internal/op/NOP.h" namespace neurun { diff --git a/runtimes/neurun/src/graph/operation/Node.h b/runtimes/neurun/src/graph/operation/Node.h index 035b969..ad20e64 100644 --- a/runtimes/neurun/src/graph/operation/Node.h +++ b/runtimes/neurun/src/graph/operation/Node.h @@ -4,7 +4,6 @@ #include #include "graph/operand/IndexSet.h" -#include "internal/op/Node.h" #include "LowerInfo.h" namespace neurun diff --git a/runtimes/neurun/src/graph/operation/Reshape.h b/runtimes/neurun/src/graph/operation/Reshape.h index 05d0efa..8470eac 100644 --- a/runtimes/neurun/src/graph/operation/Reshape.h +++ b/runtimes/neurun/src/graph/operation/Reshape.h @@ -4,7 +4,6 @@ #include #include "graph/operation/Node.h" -#include "internal/op/Reshape.h" namespace neurun { diff --git a/runtimes/neurun/src/graph/operation/Set.cc b/runtimes/neurun/src/graph/operation/Set.cc index 9c366c2..9870ec4 100644 --- a/runtimes/neurun/src/graph/operation/Set.cc +++ b/runtimes/neurun/src/graph/operation/Set.cc @@ -1,5 +1,7 @@ #include "Set.h" +#include + namespace neurun { namespace graph diff --git a/runtimes/neurun/src/graph/operation/Set.h b/runtimes/neurun/src/graph/operation/Set.h index 2c35fa8..8a42a30 100644 --- a/runtimes/neurun/src/graph/operation/Set.h +++ b/runtimes/neurun/src/graph/operation/Set.h @@ -5,7 +5,6 @@ #include "graph/operation/Index.h" #include "Node.h" -#include "internal/Model.h" #include diff --git a/runtimes/neurun/src/graph/operation/Softmax.h b/runtimes/neurun/src/graph/operation/Softmax.h index 147e8dc..358950f 100644 --- a/runtimes/neurun/src/graph/operation/Softmax.h +++ b/runtimes/neurun/src/graph/operation/Softmax.h @@ -4,7 +4,6 @@ #include #include "graph/operation/Node.h" -#include "internal/op/Softmax.h" namespace neurun { diff --git a/runtimes/neurun/src/internal/Convert.h b/runtimes/neurun/src/internal/Convert.h index 55a9cb7..1fa2ae9 100644 --- a/runtimes/neurun/src/internal/Convert.h +++ b/runtimes/neurun/src/internal/Convert.h @@ -4,7 +4,8 @@ #include #include -#include "internal/Model.h" +#include "util/feature/Shape.h" +#include "util/kernel/Shape.h" namespace internal { diff --git a/runtimes/neurun/src/internal/Model.h b/runtimes/neurun/src/internal/Model.h deleted file mode 100644 index 3977cca..0000000 --- a/runtimes/neurun/src/internal/Model.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef __INTERNAL_MODEL_H__ -#define __INTERNAL_MODEL_H__ - -#include -#include -#include -#include - -#include "internal/operand/Object.h" -#include "internal/op/NodeVisitor.h" - -namespace internal -{ -namespace tflite -{ -namespace op -{ - -class Sequence -{ -public: - Sequence() = default; - -public: - uint32_t size(void) const { return _ops.size(); } - -public: - op::Node &at(uint32_t nth) { return *(_ops.at(nth)); } - const op::Node &at(uint32_t nth) const { return *(_ops.at(nth)); } - -private: - Sequence &emplace_back(std::unique_ptr &&node) - { - _ops.emplace_back(std::move(node)); - return (*this); - } - - Sequence &insert(uint32_t nth, std::unique_ptr &&node) - { - _ops.insert(_ops.begin() + nth, std::move(node)); - return (*this); - } - -public: - template Sequence &emplace_back(Args &&... args) - { - return emplace_back(std::unique_ptr(new T{std::forward(args)...})); - } - - template Sequence &insert(uint32_t nth, Args &&... args) - { - return insert(nth, std::unique_ptr(new T{std::forward(args)...})); - } - - int find(const op::Node &node) - { - for (int i = 0; i < _ops.size(); ++i) - { - if (&at(i) == &node) - { - return i; - } - } - return -1; - } - -private: - std::vector> _ops; -}; - -} // namespace op -} // namespace tflite -} // namespace internal - -#endif // __INTERNAL_MODEL_H__ diff --git a/runtimes/neurun/src/internal/op/AvgPool2D.cc b/runtimes/neurun/src/internal/op/AvgPool2D.cc deleted file mode 100644 index a0bfb37..0000000 --- a/runtimes/neurun/src/internal/op/AvgPool2D.cc +++ /dev/null @@ -1,65 +0,0 @@ -#include "internal/op/AvgPool2D.h" -#include "internal/op/NodeVisitor.h" - -#include - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace AvgPool2D -{ -namespace implicit -{ - -void Node::accept(NodeVisitor &&v) const { v.visit(*this); } - -} // namespace implicit -} // namespace AvgPool2D -} // namespace op -} // namespace tflite -} // namespace internal - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace AvgPool2D -{ -namespace implicit -{ - -Param::Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, - const uint32_t *outputs) -{ - assert(inputCount == 7 && outputCount == 1); - - ofm_index = outputs[0]; - - // Each input should be interpreted as follows: - // - // 0 -> IFM Tensor Index - // 1 -> Padding Code (ANEURALNETWORKS_PADDING_SAME or ANEURALNETWORKS_PADDING_VALID) Index - // 2 -> Horizontal (over width) Stride Index - // 3 -> Vertial (over height) Stride Index - // 4 -> Filter Width Index - // 5 -> Filter Height Index - // 6 -> FuseCode (activation) Index - ifm_index = inputs[0]; - padding_index = inputs[1]; - hstride_index = inputs[2]; - vstride_index = inputs[3]; - kw_index = inputs[4]; - kh_index = inputs[5]; - activation_index = inputs[6]; -} - -} // namespace implicit -} // namespace AvgPool2D -} // namespace op -} // namespace tflite -} // namespace internal diff --git a/runtimes/neurun/src/internal/op/AvgPool2D.h b/runtimes/neurun/src/internal/op/AvgPool2D.h deleted file mode 100644 index 8c99e56..0000000 --- a/runtimes/neurun/src/internal/op/AvgPool2D.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef __INTERNAL_OP_AVG_POOL_2D_H__ -#define __INTERNAL_OP_AVG_POOL_2D_H__ - -#include "internal/op/Node.h" - -#include - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace AvgPool2D -{ -namespace implicit -{ - -struct Param -{ - int32_t ofm_index; - - int32_t ifm_index; - - int32_t kw_index; - int32_t kh_index; - - int32_t hstride_index; - int32_t vstride_index; - - int32_t padding_index; - int32_t activation_index; - - Param() = default; - Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, const uint32_t *outputs); -}; - -class Node final : public op::Node -{ -public: - Node(const Param ¶m) : _param(param) - { - // DO NOTHING - } - -public: - virtual ~Node() = default; - -public: - const Param ¶m(void) const { return _param; } - Param ¶m(void) { return _param; } - -public: - void accept(NodeVisitor &&) const override; - -private: - Param _param; -}; - -} // namespace implicit -} // namespace AvgPool2D -} // namespace op -} // namespace tflite -} // namespace internal - -#endif // __INTERNAL_OP_MAX_POOL_2D_H__ diff --git a/runtimes/neurun/src/internal/op/Concat.cc b/runtimes/neurun/src/internal/op/Concat.cc deleted file mode 100644 index 25164ac..0000000 --- a/runtimes/neurun/src/internal/op/Concat.cc +++ /dev/null @@ -1,53 +0,0 @@ -#include "internal/op/Concat.h" -#include "internal/op/NodeVisitor.h" - -#include - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace Concat -{ - -void Node::accept(NodeVisitor &&v) const { v.visit(*this); } - -} // namespace Concat -} // namespace op -} // namespace tflite -} // namespace internal - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace Concat -{ - -Param::Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, - const uint32_t *outputs) -{ - assert(outputCount == 1); - - ofm_index = outputs[0]; - - // When there are N + 1 inputs, each input should be interpreted as follows: - // - // [0, N) -> Input tensors - // N -> Axis - axis_index = inputs[inputCount - 1]; - - for (uint32_t n = 0; n < inputCount - 1; ++n) - { - ifm_indexes.emplace_back(inputs[n]); - } -} - -} // namespace Concat -} // namespace op -} // namespace tflite -} // namespace internal diff --git a/runtimes/neurun/src/internal/op/Concat.h b/runtimes/neurun/src/internal/op/Concat.h deleted file mode 100644 index 0b195d1..0000000 --- a/runtimes/neurun/src/internal/op/Concat.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef __INTERNAL_OP_CONCAT_H__ -#define __INTERNAL_OP_CONCAT_H__ - -#include "internal/op/Node.h" - -#include -#include - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace Concat -{ - -struct Param -{ - int32_t ofm_index; - - std::vector ifm_indexes; - int32_t axis_index; - - Param() = default; - Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, const uint32_t *outputs); -}; - -class Node final : public op::Node -{ -public: - Node(const Param ¶m) : _param(param) - { - // DO NOTHING - } - -public: - virtual ~Node() = default; - -public: - const Param ¶m(void) const { return _param; } - Param ¶m(void) { return _param; } - -public: - void accept(NodeVisitor &&) const override; - -private: - Param _param; -}; - -} // namespace Concat -} // namespace op -} // namespace tflite -} // namespace internal - -#endif // __INTERNAL_OP_CONCAT_H__ diff --git a/runtimes/neurun/src/internal/op/Conv2D.cc b/runtimes/neurun/src/internal/op/Conv2D.cc deleted file mode 100644 index b0add3c..0000000 --- a/runtimes/neurun/src/internal/op/Conv2D.cc +++ /dev/null @@ -1,66 +0,0 @@ -#include "internal/op/Conv2D.h" -#include "internal/op/NodeVisitor.h" - -#include - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace Conv2D -{ -namespace implicit -{ - -void Node::accept(NodeVisitor &&v) const { v.visit(*this); } - -} // namespace implicit -} // namespace Conv2D -} // namespace op -} // namespace tflite -} // namespace internal - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace Conv2D -{ -namespace implicit -{ - -Param::Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, - const uint32_t *outputs) -{ - assert(inputCount == 7 && outputCount == 1); - - ofm_index = outputs[0]; - - // Each input should be interpreted as follows: - // - // - // 0 -> IFM Tensor Index - // 1 -> Kernel Tensor Index - // 2 -> Bias Tensor Index - // 3 -> Padding Code (ANEURALNETWORKS_PADDING_SAME or ANEURALNETWORKS_PADDING_VALID) Index - // 4 -> Stride (width) Index - // 5 -> Stride (height) INdex - // 6 -> Activation Index - ifm_index = inputs[0]; - ker_index = inputs[1]; - bias_index = inputs[2]; - padding_index = inputs[3]; - hstride_index = inputs[4]; - vstride_index = inputs[5]; - activation_index = inputs[6]; -} - -} // namespace implicit -} // namespace Conv2D -} // namespace op -} // namespace tflite -} // namespace internal diff --git a/runtimes/neurun/src/internal/op/Conv2D.h b/runtimes/neurun/src/internal/op/Conv2D.h deleted file mode 100644 index 44184c9..0000000 --- a/runtimes/neurun/src/internal/op/Conv2D.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef __INTERNAL_OP_CONV_2D_H__ -#define __INTERNAL_OP_CONV_2D_H__ - -#include "internal/op/Node.h" - -#include - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace Conv2D -{ -namespace implicit -{ - -struct Param -{ - int32_t ofm_index; - - int32_t ifm_index; - int32_t ker_index; - int32_t bias_index; - - int32_t hstride_index; - int32_t vstride_index; - - int32_t padding_index; - int32_t activation_index; - - Param() = default; - Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, const uint32_t *outputs); -}; - -class Node final : public op::Node -{ -public: - Node(const Param ¶m) : _param(param) - { - // DO NOTHING - } - -public: - virtual ~Node() = default; - -public: - const Param ¶m(void) const { return _param; } - Param ¶m(void) { return _param; } - -public: - void accept(NodeVisitor &&) const override; - -private: - Param _param; -}; - -} // namespace implicit -} // namespace Conv2D -} // namespace op -} // namespace tflite -} // namespace internal - -#endif // __INTERNAL_OP_CONV_2D_H__ diff --git a/runtimes/neurun/src/internal/op/FullyConnected.cc b/runtimes/neurun/src/internal/op/FullyConnected.cc deleted file mode 100644 index 38071e5..0000000 --- a/runtimes/neurun/src/internal/op/FullyConnected.cc +++ /dev/null @@ -1,53 +0,0 @@ -#include "internal/op/FullyConnected.h" -#include "internal/op/NodeVisitor.h" - -#include - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace FullyConnected -{ - -void Node::accept(NodeVisitor &&v) const { v.visit(*this); } - -} // namespace FullyConnected -} // namespace op -} // namespace tflite -} // namespace internal - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace FullyConnected -{ - -Param::Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, - const uint32_t *outputs) -{ - assert(inputCount == 4 && outputCount == 1); - - output_index = outputs[0]; - - // Each input should be interpreted as follows: - // - // 0 -> A tensor, specifying the input. - // 1 -> A 2-D tensor, specifying the weights - // 2 -> A 1-D tensor, specifying the bias - // 3 -> An INT32 value, and has to be one of the FuseCode values - input_index = inputs[0]; - weight_index = inputs[1]; - bias_index = inputs[2]; - activation_index = inputs[3]; -} - -} // namespace FullyConnected -} // namespace op -} // namespace tflite -} // namespace internal diff --git a/runtimes/neurun/src/internal/op/FullyConnected.h b/runtimes/neurun/src/internal/op/FullyConnected.h deleted file mode 100644 index a0c446b..0000000 --- a/runtimes/neurun/src/internal/op/FullyConnected.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef __INTERNAL_OP_FULLY_CONNTECTED_H__ -#define __INTERNAL_OP_FULLY_CONNTECTED_H__ - -#include "internal/op/Node.h" - -#include - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace FullyConnected -{ - -struct Param -{ - int32_t output_index; - - int32_t input_index; - int32_t weight_index; - int32_t bias_index; - int32_t activation_index; - - Param() = default; - Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, const uint32_t *outputs); -}; - -class Node final : public op::Node -{ -public: - Node(const Param ¶m) : _param(param) - { - // DO NOTHING - } - -public: - virtual ~Node() = default; - -public: - const Param ¶m(void) const { return _param; } - Param ¶m(void) { return _param; } - -public: - void accept(NodeVisitor &&) const override; - -private: - Param _param; -}; - -} // namespace FullyConnected -} // namespace op -} // namespace tflite -} // namespace internal - -#endif // __INTERNAL_OP_FULLY_CONNTECTED_H__ diff --git a/runtimes/neurun/src/internal/op/MaxPool2D.cc b/runtimes/neurun/src/internal/op/MaxPool2D.cc deleted file mode 100644 index 2f80b54..0000000 --- a/runtimes/neurun/src/internal/op/MaxPool2D.cc +++ /dev/null @@ -1,65 +0,0 @@ -#include "internal/op/MaxPool2D.h" -#include "internal/op/NodeVisitor.h" - -#include - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace MaxPool2D -{ -namespace implicit -{ - -void Node::accept(NodeVisitor &&v) const { v.visit(*this); } - -} // namespace implicit -} // namespace MaxPool2D -} // namespace op -} // namespace tflite -} // namespace internal - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace MaxPool2D -{ -namespace implicit -{ - -Param::Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, - const uint32_t *outputs) -{ - assert(inputCount == 7 && outputCount == 1); - - ofm_index = outputs[0]; - - // Each input should be interpreted as follows: - // - // 0 -> IFM Tensor Index - // 1 -> Padding Code (ANEURALNETWORKS_PADDING_SAME or ANEURALNETWORKS_PADDING_VALID) Index - // 2 -> Horizontal (over width) Stride Index - // 3 -> Vertial (over height) Stride Index - // 4 -> Filter Width Index - // 5 -> Filter Height Index - // 6 -> FuseCode (activation) Index - ifm_index = inputs[0]; - padding_index = inputs[1]; - hstride_index = inputs[2]; - vstride_index = inputs[3]; - kw_index = inputs[4]; - kh_index = inputs[5]; - activation_index = inputs[6]; -} - -} // namespace implicit -} // namespace MaxPool2D -} // namespace op -} // namespace tflite -} // namespace internal diff --git a/runtimes/neurun/src/internal/op/MaxPool2D.h b/runtimes/neurun/src/internal/op/MaxPool2D.h deleted file mode 100644 index 4470c9a..0000000 --- a/runtimes/neurun/src/internal/op/MaxPool2D.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef __INTERNAL_OP_MAX_POOL_2D_H__ -#define __INTERNAL_OP_MAX_POOL_2D_H__ - -#include "internal/op/Node.h" - -#include - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace MaxPool2D -{ -namespace implicit -{ - -struct Param -{ - int32_t ofm_index; - - int32_t ifm_index; - - int32_t kw_index; - int32_t kh_index; - - int32_t hstride_index; - int32_t vstride_index; - - int32_t padding_index; - int32_t activation_index; - - Param() = default; - Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, const uint32_t *outputs); -}; - -class Node final : public op::Node -{ -public: - Node(const Param ¶m) : _param(param) - { - // DO NOTHING - } - -public: - virtual ~Node() = default; - -public: - const Param ¶m(void) const { return _param; } - Param ¶m(void) { return _param; } - -public: - void accept(NodeVisitor &&) const override; - -private: - Param _param; -}; - -} // namespace implicit -} // namespace MaxPool2D -} // namespace op -} // namespace tflite -} // namespace internal - -#endif // __INTERNAL_OP_MAX_POOL_2D_H__ diff --git a/runtimes/neurun/src/internal/op/NOP.cc b/runtimes/neurun/src/internal/op/NOP.cc deleted file mode 100644 index 5ee59b5..0000000 --- a/runtimes/neurun/src/internal/op/NOP.cc +++ /dev/null @@ -1,37 +0,0 @@ -#include "internal/op/NOP.h" -#include "internal/op/NodeVisitor.h" - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace NOP -{ - -void Node::accept(NodeVisitor &&v) const { v.visit(*this); } - -} // namespace NOP -} // namespace op -} // namespace tflite -} // namespace internal - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace NOP -{ - -Param::Param(std::initializer_list ifm_indexes, std::initializer_list ofm_indexes) - : ifm_indexes(ifm_indexes), ofm_indexes(ofm_indexes) -{ -} - -} // namespace NOP -} // namespace op -} // namespace tflite -} // namespace internal diff --git a/runtimes/neurun/src/internal/op/NOP.h b/runtimes/neurun/src/internal/op/NOP.h deleted file mode 100644 index 4adcfa3..0000000 --- a/runtimes/neurun/src/internal/op/NOP.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __INTERNAL_OP_NOP_H__ -#define __INTERNAL_OP_NOP_H__ - -#include "internal/op/Node.h" - -#include -#include -#include - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace NOP -{ - -struct Param -{ - std::vector ifm_indexes; - std::vector ofm_indexes; - - Param() = default; - Param(std::initializer_list ifm_indexes, std::initializer_list ofm_indexes); -}; - -class Node final : public op::Node -{ -public: - Node(const Param ¶m) : _param(param) - { - // DO NOTHING - } - -public: - virtual ~Node() = default; - -public: - const Param ¶m(void) const { return _param; } - Param ¶m(void) { return _param; } - -public: - void accept(NodeVisitor &&) const override; - -private: - Param _param; -}; - -} // namespace NOP -} // namespace op -} // namespace tflite -} // namespace internal - -#endif // __INTERNAL_OP_NOP_H__ diff --git a/runtimes/neurun/src/internal/op/Node.h b/runtimes/neurun/src/internal/op/Node.h deleted file mode 100644 index dbaa7dd..0000000 --- a/runtimes/neurun/src/internal/op/Node.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __INTERNAL_OP_NODE_H__ -#define __INTERNAL_OP_NODE_H__ - -namespace internal -{ -namespace tflite -{ -namespace op -{ - -struct NodeVisitor; - -struct Node -{ - virtual ~Node() = default; - - virtual void accept(NodeVisitor &&) const = 0; -}; - -} // namespace op -} // namespace tflite -} // namespace internal - -#endif // __INTERNAL_OP_NODE_H__ diff --git a/runtimes/neurun/src/internal/op/NodeVisitor.h b/runtimes/neurun/src/internal/op/NodeVisitor.h deleted file mode 100644 index 6d9de9f..0000000 --- a/runtimes/neurun/src/internal/op/NodeVisitor.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __INTERNAL_OP_NODE_VISITOR_H__ -#define __INTERNAL_OP_NODE_VISITOR_H__ - -#include "internal/op/Conv2D.h" -#include "internal/op/MaxPool2D.h" -#include "internal/op/AvgPool2D.h" -#include "internal/op/Concat.h" -#include "internal/op/Reshape.h" -#include "internal/op/FullyConnected.h" -#include "internal/op/Softmax.h" -#include "internal/op/NOP.h" - -namespace internal -{ -namespace tflite -{ -namespace op -{ - -struct NodeVisitor -{ - virtual ~NodeVisitor() = default; - - virtual void visit(const Conv2D::implicit::Node &) = 0; - virtual void visit(const MaxPool2D::implicit::Node &) = 0; - virtual void visit(const AvgPool2D::implicit::Node &) = 0; - virtual void visit(const Concat::Node &) = 0; - virtual void visit(const Reshape::Node &) = 0; - virtual void visit(const FullyConnected::Node &) = 0; - virtual void visit(const Softmax::Node &) = 0; - virtual void visit(const NOP::Node &) = 0; -}; - -} // namespace op -} // namespace tflite -} // namespace internal - -#endif // __INTERNAL_OP_NODE_VISITOR_H__ diff --git a/runtimes/neurun/src/internal/op/Reshape.cc b/runtimes/neurun/src/internal/op/Reshape.cc deleted file mode 100644 index cbf0162..0000000 --- a/runtimes/neurun/src/internal/op/Reshape.cc +++ /dev/null @@ -1,50 +0,0 @@ -#include "internal/op/Reshape.h" -#include "internal/op/NodeVisitor.h" - -#include - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace Reshape -{ - -void Node::accept(NodeVisitor &&v) const { v.visit(*this); } - -} // namespace Reshape -} // namespace op -} // namespace tflite -} // namespace internal - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace Reshape -{ - -Param::Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, - const uint32_t *outputs) -{ - assert(inputCount == 2 && outputCount == 1); - - output_index = outputs[0]; - - // Each input should be interpreted as follows: - // - // 0 -> A tensor, specifying the tensor to be reshaped. - // 1 -> A 1-D tensor of type ANEURALNETWORKS_TENSOR_INT32, defining the shape of the output - // tensor - input_index = inputs[0]; - shape_index = inputs[1]; -} - -} // namespace Reshape -} // namespace op -} // namespace tflite -} // namespace internal diff --git a/runtimes/neurun/src/internal/op/Reshape.h b/runtimes/neurun/src/internal/op/Reshape.h deleted file mode 100644 index 8600c6b..0000000 --- a/runtimes/neurun/src/internal/op/Reshape.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __INTERNAL_OP_RESHAPE_H__ -#define __INTERNAL_OP_RESHAPE_H__ - -#include "internal/op/Node.h" - -#include - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace Reshape -{ - -struct Param -{ - int32_t output_index; - - int32_t input_index; - int32_t shape_index; - - Param() = default; - Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, const uint32_t *outputs); -}; - -class Node final : public op::Node -{ -public: - Node(const Param ¶m) : _param(param) - { - // DO NOTHING - } - -public: - virtual ~Node() = default; - -public: - const Param ¶m(void) const { return _param; } - Param ¶m(void) { return _param; } - -public: - void accept(NodeVisitor &&) const override; - -private: - Param _param; -}; - -} // namespace Reshape -} // namespace op -} // namespace tflite -} // namespace internal - -#endif // __INTERNAL_OP_RESHAPE_H__ diff --git a/runtimes/neurun/src/internal/op/Softmax.cc b/runtimes/neurun/src/internal/op/Softmax.cc deleted file mode 100644 index 38b0043..0000000 --- a/runtimes/neurun/src/internal/op/Softmax.cc +++ /dev/null @@ -1,49 +0,0 @@ -#include "internal/op/Softmax.h" -#include "internal/op/NodeVisitor.h" - -#include - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace Softmax -{ - -void Node::accept(NodeVisitor &&v) const { v.visit(*this); } - -} // namespace Softmax -} // namespace op -} // namespace tflite -} // namespace internal - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace Softmax -{ - -Param::Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, - const uint32_t *outputs) -{ - assert(inputCount == 2 && outputCount == 1); - - output_index = outputs[0]; - - // Each input should be interpreted as follows: - // - // 0 -> A 2-D or 4-D tensor, specifying the tensor to be reshaped. - // 1 -> FLOAT32 value, specifying the positive scaling factor for the exponent, beta. - input_index = inputs[0]; - scale_index = inputs[1]; -} - -} // namespace Softmax -} // namespace op -} // namespace tflite -} // namespace internal diff --git a/runtimes/neurun/src/internal/op/Softmax.h b/runtimes/neurun/src/internal/op/Softmax.h deleted file mode 100644 index f1b7624..0000000 --- a/runtimes/neurun/src/internal/op/Softmax.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __INTERNAL_OP_SOFTMAX_H__ -#define __INTERNAL_OP_SOFTMAX_H__ - -#include "internal/op/Node.h" - -#include - -namespace internal -{ -namespace tflite -{ -namespace op -{ -namespace Softmax -{ - -struct Param -{ - int32_t output_index; - - int32_t input_index; - int32_t scale_index; - - Param() = default; - Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, const uint32_t *outputs); -}; - -class Node final : public op::Node -{ -public: - Node(const Param ¶m) : _param(param) - { - // DO NOTHING - } - -public: - virtual ~Node() = default; - -public: - const Param ¶m(void) const { return _param; } - Param ¶m(void) { return _param; } - -public: - void accept(NodeVisitor &&) const override; - -private: - Param _param; -}; - -} // namespace Softmax -} // namespace op -} // namespace tflite -} // namespace internal - -#endif // __INTERNAL_OP_SOFTMAX_H__ diff --git a/runtimes/neurun/src/kernel/acl_cl/ConcatLayer.h b/runtimes/neurun/src/kernel/acl_cl/ConcatLayer.h index 5c886d8..1341832 100644 --- a/runtimes/neurun/src/kernel/acl_cl/ConcatLayer.h +++ b/runtimes/neurun/src/kernel/acl_cl/ConcatLayer.h @@ -22,8 +22,6 @@ #include #include -#include "internal/Model.h" - // TODO Remove this unnecessary dependency. This is only for OperandType. // If we remove this, we can also remove cpu kernel library dependency #include "kernel/cpu/OperationUtils.h" diff --git a/runtimes/neurun/src/kernel/cpu/AvgPoolLayer.h b/runtimes/neurun/src/kernel/cpu/AvgPoolLayer.h index ab5c3bf..5d2540c 100644 --- a/runtimes/neurun/src/kernel/cpu/AvgPoolLayer.h +++ b/runtimes/neurun/src/kernel/cpu/AvgPoolLayer.h @@ -5,7 +5,6 @@ #include -#include "internal/Model.h" #include "kernel/cpu/OperationUtils.h" using namespace neurun::kernel::cpu; diff --git a/runtimes/neurun/src/kernel/cpu/ConcatLayer.h b/runtimes/neurun/src/kernel/cpu/ConcatLayer.h index 1f36c9d..a209de0 100644 --- a/runtimes/neurun/src/kernel/cpu/ConcatLayer.h +++ b/runtimes/neurun/src/kernel/cpu/ConcatLayer.h @@ -22,7 +22,6 @@ #include -#include "internal/Model.h" #include "kernel/cpu/OperationUtils.h" using namespace neurun::kernel::cpu; diff --git a/runtimes/neurun/src/kernel/cpu/ConvolutionLayer.h b/runtimes/neurun/src/kernel/cpu/ConvolutionLayer.h index 25bd24a..44ffc3e 100644 --- a/runtimes/neurun/src/kernel/cpu/ConvolutionLayer.h +++ b/runtimes/neurun/src/kernel/cpu/ConvolutionLayer.h @@ -5,7 +5,6 @@ #include -#include "internal/Model.h" #include "kernel/cpu/OperationUtils.h" using namespace neurun::kernel::cpu; diff --git a/runtimes/neurun/src/kernel/cpu/FullyConnectedLayer.h b/runtimes/neurun/src/kernel/cpu/FullyConnectedLayer.h index ba1666d..637cf54 100644 --- a/runtimes/neurun/src/kernel/cpu/FullyConnectedLayer.h +++ b/runtimes/neurun/src/kernel/cpu/FullyConnectedLayer.h @@ -5,7 +5,6 @@ #include -#include "internal/Model.h" #include "kernel/cpu/OperationUtils.h" using namespace neurun::kernel::cpu; diff --git a/runtimes/neurun/src/kernel/cpu/MaxPoolLayer.h b/runtimes/neurun/src/kernel/cpu/MaxPoolLayer.h index 219bbc6..60d15f9 100644 --- a/runtimes/neurun/src/kernel/cpu/MaxPoolLayer.h +++ b/runtimes/neurun/src/kernel/cpu/MaxPoolLayer.h @@ -5,7 +5,6 @@ #include -#include "internal/Model.h" #include "kernel/cpu/OperationUtils.h" using namespace neurun::kernel::cpu; diff --git a/runtimes/neurun/src/kernel/cpu/OperationUtils.h b/runtimes/neurun/src/kernel/cpu/OperationUtils.h index c3ace90..412920e 100644 --- a/runtimes/neurun/src/kernel/cpu/OperationUtils.h +++ b/runtimes/neurun/src/kernel/cpu/OperationUtils.h @@ -7,8 +7,8 @@ #include #include -#include "internal/Model.h" #include "tensorflow/contrib/lite/kernels/internal/types.h" +#include "internal/operand/Object.h" namespace neurun { diff --git a/runtimes/neurun/src/kernel/cpu/ReshapeLayer.h b/runtimes/neurun/src/kernel/cpu/ReshapeLayer.h index 5c3e059..23ac710 100644 --- a/runtimes/neurun/src/kernel/cpu/ReshapeLayer.h +++ b/runtimes/neurun/src/kernel/cpu/ReshapeLayer.h @@ -5,7 +5,6 @@ #include -#include "internal/Model.h" #include "kernel/cpu/OperationUtils.h" using namespace neurun::kernel::cpu; diff --git a/runtimes/neurun/src/kernel/cpu/SoftMaxLayer.h b/runtimes/neurun/src/kernel/cpu/SoftMaxLayer.h index b627ad7..0008ba4 100644 --- a/runtimes/neurun/src/kernel/cpu/SoftMaxLayer.h +++ b/runtimes/neurun/src/kernel/cpu/SoftMaxLayer.h @@ -5,7 +5,6 @@ #include -#include "internal/Model.h" #include "kernel/cpu/OperationUtils.h" using namespace neurun::kernel::cpu; diff --git a/runtimes/neurun/src/linear/Linear.cc b/runtimes/neurun/src/linear/Linear.cc index 293c929..3d56228 100644 --- a/runtimes/neurun/src/linear/Linear.cc +++ b/runtimes/neurun/src/linear/Linear.cc @@ -1,7 +1,6 @@ #include "Linear.h" #include "graph/Graph.h" -#include "internal/op/Node.h" #include "codegen/BackendResolver.h" -- 2.7.4