From a41629ffe046993e16fafbff37b11db73df74f47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A2=85=ED=98=84/On-Device=20Lab=28SR=29/Staff?= =?UTF-8?q?=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Tue, 17 Sep 2019 13:55:27 +0900 Subject: [locomotiv] Simplify ReLU6 implementation (#7506) Let's make ReLU6 similar to other element-wise unary operations. Signed-off-by: Jonghyun Park --- compiler/locomotiv/src/Node/ReLU6.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/compiler/locomotiv/src/Node/ReLU6.cpp b/compiler/locomotiv/src/Node/ReLU6.cpp index 7da892628..586c015fc 100644 --- a/compiler/locomotiv/src/Node/ReLU6.cpp +++ b/compiler/locomotiv/src/Node/ReLU6.cpp @@ -16,6 +16,8 @@ #include "NodeExecution.h" +// TODO Remove deprecated code +#if 0 #include "NodeDataImpl.h" #include "NodeDomain.h" #include "Validation.h" @@ -31,6 +33,7 @@ using nncc::core::ADT::tensor::make_buffer; #include #include +#endif namespace { @@ -44,6 +47,8 @@ namespace locomotiv void NodeExecution::execute(loco::ReLU6 *relu6) { +// TODO Remove deprecated code +#if 0 auto input_data = annot_data(relu6->input()); validate(input_data, "Input not ready"); @@ -76,6 +81,16 @@ void NodeExecution::execute(loco::ReLU6 *relu6) assert(relu6_data != nullptr); annot_data(relu6, std::move(relu6_data)); annot_domain(relu6, annot_domain(relu6->input())); +#endif + + struct Func final : public UnaryFunc + { + float apply(float v) const final { return relu6_ew(v); } + }; + + Func f; + + eltwise_unary(relu6, f); } } // namespace locomotiv -- cgit v1.2.3