From 88a406bf381a18698bf998bc3e87e02bf62d7117 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, 9 Aug 2018 07:16:50 +0900 Subject: [PATCH] [neurun] Graph : Introduce operation Concat (#2223) Introduce `neurun::graph::operation::Concat` which is a node in Graph IR. Signed-off-by: Hanjoung Lee --- runtimes/neurun/src/graph/operation/Concat.cc | 25 ++++++++++++++++++ runtimes/neurun/src/graph/operation/Concat.h | 37 +++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 runtimes/neurun/src/graph/operation/Concat.cc create mode 100644 runtimes/neurun/src/graph/operation/Concat.h diff --git a/runtimes/neurun/src/graph/operation/Concat.cc b/runtimes/neurun/src/graph/operation/Concat.cc new file mode 100644 index 0000000..73b5e93 --- /dev/null +++ b/runtimes/neurun/src/graph/operation/Concat.cc @@ -0,0 +1,25 @@ +#include "Concat.h" + +namespace neurun +{ +namespace graph +{ +namespace operation +{ +namespace Concat +{ + +operand::IndexSet Node::inputs() const +{ + operand::IndexSet set; + for (auto index : _op->param().ifm_indexes) + { + set.append({index}); + } + return set; +} + +} // namespace Concat +} // namespace operation +} // namespace graph +} // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/Concat.h b/runtimes/neurun/src/graph/operation/Concat.h new file mode 100644 index 0000000..feda9c8 --- /dev/null +++ b/runtimes/neurun/src/graph/operation/Concat.h @@ -0,0 +1,37 @@ +#ifndef __NEURUN_GRAPH_OPERATION_CONCAT_H__ +#define __NEURUN_GRAPH_OPERATION_CONCAT_H__ + +#include + +#include "graph/operation/Node.h" +#include "internal/op/Concat.h" + +namespace neurun +{ +namespace graph +{ +namespace operation +{ +namespace Concat +{ + +class Node : public graph::operation::Node +{ +public: + Node(std::unique_ptr<::internal::tflite::op::Concat::Node> &&op) : _op{std::move(op)} {} + +public: + virtual operand::IndexSet inputs() const override; + virtual operand::IndexSet outputs() const override { return {_op->param().ofm_index}; } + virtual const ::internal::tflite::op::Node *op() const override { return _op.get(); } + +private: + std::unique_ptr<::internal::tflite::op::Concat::Node> _op; +}; + +} // namespace Concat +} // namespace operation +} // namespace graph +} // namespace neurun + +#endif // __NEURUN_GRAPH_OPERATION_CONCAT_H__ -- 2.7.4