From b04589da7f1333831ab3a1f0422f6274fcba0ad7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=84=B8=ED=9D=AC/On-Device=20Lab=28SR=29/Princip?= =?utf8?q?al=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Fri, 17 May 2019 11:14:38 +0900 Subject: [PATCH] [locomotiv] Relocate codes that may be duplicates (#3503) This will relocate relu codes that may be duplicates in the future. Signed-off-by: SaeHie Park --- contrib/locomotiv/src/Node/ReLU.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/contrib/locomotiv/src/Node/ReLU.cpp b/contrib/locomotiv/src/Node/ReLU.cpp index b61f242..2c1c9c6 100644 --- a/contrib/locomotiv/src/Node/ReLU.cpp +++ b/contrib/locomotiv/src/Node/ReLU.cpp @@ -29,6 +29,7 @@ using nncc::core::ADT::tensor::IndexEnumerator; using nncc::core::ADT::tensor::LexicalLayout; using nncc::core::ADT::tensor::make_buffer; +#include #include namespace @@ -50,6 +51,8 @@ void NodeExecution::execute(loco::ReLU *relu) throw std::runtime_error("Ingredient not ready"); } + std::unique_ptr relu_data = nullptr; + switch (input_data->dtype()) { case loco::DataType::FLOAT32: @@ -64,14 +67,16 @@ void NodeExecution::execute(loco::ReLU *relu) relu_buf.at(index) = relu_ew(input_bufptr->at(index)); } - auto relu_data = make_data(relu_buf); - erase_annot_data(relu); - annot_data(relu, std::move(relu_data)); + relu_data = make_data(relu_buf); break; } default: throw std::runtime_error("NYI for this DataType"); } + + assert(relu_data != nullptr); + erase_annot_data(relu); + annot_data(relu, std::move(relu_data)); } } // namespace locomotiv -- 2.7.4