From feaaa19c436833bb5e05585356e1958b4c57fb04 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Staff=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Thu, 11 Oct 2018 09:38:32 +0900 Subject: [PATCH] [enco] Compile ReLU op in Eval instruction (#1813) With this commit, ANNOpBuild is now able to compile a simple ReLU op in Eval instruction. Signed-off-by: Jonghyun Park --- contrib/enco/core/src/Transforms/Split.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/contrib/enco/core/src/Transforms/Split.cpp b/contrib/enco/core/src/Transforms/Split.cpp index f0cbfa7..9d7a366 100644 --- a/contrib/enco/core/src/Transforms/Split.cpp +++ b/contrib/enco/core/src/Transforms/Split.cpp @@ -403,6 +403,28 @@ public: } } } + else if (auto relu = eval->op()->asReLU()) + { + if (auto load = relu->arg()->asLoad()) + { + // Let's compile the following code fragment: + // + // %ofm = eval(ReLU(Load(%ifm)) + // + // TODO Support objects of other kinds, such as Tensor + auto ifm = load->object()->asFeature(); + auto ofm = eval->out()->asFeature(); + + assert(ifm != nullptr && ofm != nullptr); + + auto app = make_unique(); + + app->ifm(ifm); + app->ofm(ofm); + + return std::move(app); + } + } // Return nullptr if a given Eval instruction is incompatible return nullptr; -- 2.7.4