[neurun] Enable Logistic op in acl_cl (#4599)
author윤지영/On-Device Lab(SR)/Staff Engineer/삼성전자 <jy910.yun@samsung.com>
Thu, 7 Mar 2019 10:28:25 +0000 (19:28 +0900)
committer오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Thu, 7 Mar 2019 10:28:25 +0000 (19:28 +0900)
* [neurun] Enable Logistic op in acl_cl

This commit allows to run logistic op using acl_cl kernel

Signed-off-by: Jiyoung Yun <jy910.yun@samsung.com>
* Remove these tests in skip list of neurun

runtimes/neurun/src/backend/acl_cl/StageGenerator.cc
runtimes/neurun/src/backend/acl_cl/StageGenerator.h
tests/nnapi/nnapi_gtest.skip.armv7l-linux.neurun

index c3f711b..8185c6a 100644 (file)
@@ -1358,6 +1358,42 @@ void StageGenerator::visit(const model::operation::ExpNode &node)
   });
 }
 
+void StageGenerator::visit(const model::operation::LogisticNode &node)
+{
+  const auto output_index{node.getOutputs().at(0)};
+  const auto input_index{node.getInputs().at(model::operation::LogisticNode::Input::INPUT)};
+
+  // Construct operation parameters
+  struct Param
+  {
+    model::operand::Index ofm_index;
+    model::operand::Index ifm_index;
+  };
+
+  Param param;
+
+  param.ofm_index = output_index;
+  param.ifm_index = input_index;
+
+  auto tensors = _tensor_builder;
+
+  returnStage([tensors, param](IExecutionBuilder &builder) {
+    auto ofm_alloc = tensors->at(param.ofm_index).get();
+    auto ifm_alloc = tensors->at(param.ifm_index).get();
+
+    const ::arm_compute::ActivationLayerInfo act_info{
+        ::arm_compute::ActivationLayerInfo::ActivationFunction::LOGISTIC};
+
+    auto fn = make_layer<::arm_compute::CLActivationLayer>();
+
+    fn->configure(ifm_alloc->handle(), ofm_alloc->handle(), act_info);
+
+    auto acl_fn = make_cl_function(std::move(fn));
+
+    builder.append(std::move(acl_fn));
+  });
+}
+
 } // namespace acl_cl
 } // namespace backend
 } // namespace neurun
index e86b47b..a2c9177 100644 (file)
@@ -54,6 +54,7 @@ public:
   virtual void visit(const model::operation::CastNode &) override;
   virtual void visit(const model::operation::DivNode &) override;
   virtual void visit(const model::operation::ExpNode &) override;
+  virtual void visit(const model::operation::LogisticNode &) override;
 
 private:
   const neurun::model::operand::Set &_ctx;
index fe3076f..b6bbac8 100644 (file)
@@ -25,7 +25,7 @@ GeneratedTests.l2_pool*
 GeneratedTests.local_response_norm*
 GeneratedTests.logical_and_ex*
 GeneratedTests.logical_or_ex*
-GeneratedTests.logistic*
+GeneratedTests.logistic_quant*
 GeneratedTests.lsh_projection*
 GeneratedTests.lstm*
 GeneratedTests.mobilenet*