From 2c0f5130921eec99cd3559b5f8f3365b9d3d9263 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=98=A4=ED=98=95=EC=84=9D/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Senior=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Wed, 30 May 2018 16:53:27 +0900 Subject: [PATCH] Fix format for pure acl runtime (#1435) Fix format for pure acl runtime Enable format check for pure acl runtime Signed-off-by: Hyeongseok Oh --- runtimes/pure_arm_compute/.FORMATCHECKED | 0 runtimes/pure_arm_compute/src/compilation.cc | 6 +++--- runtimes/pure_arm_compute/src/event.cc | 10 ++-------- runtimes/pure_arm_compute/src/execution.cc | 8 +++----- .../src/internal/layers/GenericReshapeLayer.cc | 3 ++- .../internal/layers/SimpleArithmeticAdditionLayer.h | 3 ++- runtimes/pure_arm_compute/src/memory.cc | 5 +---- runtimes/pure_arm_compute/src/model.cc | 19 +++++-------------- runtimes/pure_arm_compute/symbolcheck.cpp | 15 ++++++++------- 9 files changed, 26 insertions(+), 43 deletions(-) create mode 100644 runtimes/pure_arm_compute/.FORMATCHECKED diff --git a/runtimes/pure_arm_compute/.FORMATCHECKED b/runtimes/pure_arm_compute/.FORMATCHECKED new file mode 100644 index 0000000..e69de29 diff --git a/runtimes/pure_arm_compute/src/compilation.cc b/runtimes/pure_arm_compute/src/compilation.cc index 0b580d9..6ad1c1c 100644 --- a/runtimes/pure_arm_compute/src/compilation.cc +++ b/runtimes/pure_arm_compute/src/compilation.cc @@ -24,9 +24,9 @@ #include "model.h" #include "logging.h" -template T from_env(const char *); +template T from_env(const char *); -template<> bool from_env(const char *s) +template <> bool from_env(const char *s) { if (s == nullptr) { @@ -323,7 +323,7 @@ void Planner::visit(const ::internal::tflite::op::Add::Node &node) // NOTE CLArithmeticAddition emits incorrect values for ADAS model. // TODO Figure out why this happens, and fix it - if(from_env(std::getenv("USE_CL_ARITHMETIC_ADDTION"))) + if (from_env(std::getenv("USE_CL_ARITHMETIC_ADDTION"))) { auto l = make_layer<::arm_compute::CLArithmeticAddition>(); diff --git a/runtimes/pure_arm_compute/src/event.cc b/runtimes/pure_arm_compute/src/event.cc index 56b7946..9a406e1 100644 --- a/runtimes/pure_arm_compute/src/event.cc +++ b/runtimes/pure_arm_compute/src/event.cc @@ -2,12 +2,6 @@ #include "event.h" -int ANeuralNetworksEvent_wait(ANeuralNetworksEvent *event) -{ - return ANEURALNETWORKS_NO_ERROR; -} +int ANeuralNetworksEvent_wait(ANeuralNetworksEvent *event) { return ANEURALNETWORKS_NO_ERROR; } -void ANeuralNetworksEvent_free(ANeuralNetworksEvent *event) -{ - delete event; -} +void ANeuralNetworksEvent_free(ANeuralNetworksEvent *event) { delete event; } diff --git a/runtimes/pure_arm_compute/src/execution.cc b/runtimes/pure_arm_compute/src/execution.cc index 731531f..f56a6bd 100644 --- a/runtimes/pure_arm_compute/src/execution.cc +++ b/runtimes/pure_arm_compute/src/execution.cc @@ -149,8 +149,8 @@ int ANeuralNetworksExecution_create(ANeuralNetworksCompilation *compilation, } int ANeuralNetworksExecution_setInput(ANeuralNetworksExecution *execution, int32_t index, - const ANeuralNetworksOperandType *type, - const void *buffer, size_t length) + const ANeuralNetworksOperandType *type, const void *buffer, + size_t length) { const auto &operands = execution->plan().model().operands(); @@ -251,6 +251,4 @@ int ANeuralNetworksExecution_startCompute(ANeuralNetworksExecution *execution, return ANEURALNETWORKS_NO_ERROR; } -void ANeuralNetworksExecution_free(ANeuralNetworksExecution *execution) -{ -} +void ANeuralNetworksExecution_free(ANeuralNetworksExecution *execution) {} diff --git a/runtimes/pure_arm_compute/src/internal/layers/GenericReshapeLayer.cc b/runtimes/pure_arm_compute/src/internal/layers/GenericReshapeLayer.cc index 164dd29..b3e4488 100644 --- a/runtimes/pure_arm_compute/src/internal/layers/GenericReshapeLayer.cc +++ b/runtimes/pure_arm_compute/src/internal/layers/GenericReshapeLayer.cc @@ -1,6 +1,7 @@ #include "GenericReshapeLayer.h" -void GenericReshapeLayer::configure(::arm_compute::ICLTensor *input, ::arm_compute::ICLTensor *output) +void GenericReshapeLayer::configure(::arm_compute::ICLTensor *input, + ::arm_compute::ICLTensor *output) { _input = input; _output = output; diff --git a/runtimes/pure_arm_compute/src/internal/layers/SimpleArithmeticAdditionLayer.h b/runtimes/pure_arm_compute/src/internal/layers/SimpleArithmeticAdditionLayer.h index 77f8962..aefa50d 100644 --- a/runtimes/pure_arm_compute/src/internal/layers/SimpleArithmeticAdditionLayer.h +++ b/runtimes/pure_arm_compute/src/internal/layers/SimpleArithmeticAdditionLayer.h @@ -6,7 +6,8 @@ class SimpleArithmeticAdditionLayer : public ::arm_compute::IFunction { public: - void configure(::arm_compute::ICLTensor *lhs, ::arm_compute::ICLTensor *rhs, ::arm_compute::ICLTensor *out) + void configure(::arm_compute::ICLTensor *lhs, ::arm_compute::ICLTensor *rhs, + ::arm_compute::ICLTensor *out) { _lhs = lhs; _rhs = rhs; diff --git a/runtimes/pure_arm_compute/src/memory.cc b/runtimes/pure_arm_compute/src/memory.cc index 7a951d7..9fca307 100644 --- a/runtimes/pure_arm_compute/src/memory.cc +++ b/runtimes/pure_arm_compute/src/memory.cc @@ -11,10 +11,7 @@ int ANeuralNetworksMemory_createFromFd(size_t size, int protect, int fd, size_t return ANEURALNETWORKS_NO_ERROR; } -void ANeuralNetworksMemory_free(ANeuralNetworksMemory *memory) -{ - delete memory; -} +void ANeuralNetworksMemory_free(ANeuralNetworksMemory *memory) { delete memory; } // // ANeuralNetworksMemory diff --git a/runtimes/pure_arm_compute/src/model.cc b/runtimes/pure_arm_compute/src/model.cc index 60bc5c5..3e4cf5b 100644 --- a/runtimes/pure_arm_compute/src/model.cc +++ b/runtimes/pure_arm_compute/src/model.cc @@ -13,10 +13,7 @@ int ANeuralNetworksModel_create(ANeuralNetworksModel **model) return ANEURALNETWORKS_NO_ERROR; } -void ANeuralNetworksModel_free(ANeuralNetworksModel *model) -{ - delete model; -} +void ANeuralNetworksModel_free(ANeuralNetworksModel *model) { delete model; } int ANeuralNetworksModel_addOperand(ANeuralNetworksModel *model, const ANeuralNetworksOperandType *type) @@ -54,8 +51,7 @@ int ANeuralNetworksModel_setOperandValue(ANeuralNetworksModel *model, int32_t in return ANEURALNETWORKS_NO_ERROR; } -int ANeuralNetworksModel_setOperandValueFromMemory(ANeuralNetworksModel *model, - int32_t index, +int ANeuralNetworksModel_setOperandValueFromMemory(ANeuralNetworksModel *model, int32_t index, const ANeuralNetworksMemory *memory, size_t offset, size_t length) { @@ -233,10 +229,8 @@ int ANeuralNetworksModel_addOperation(ANeuralNetworksModel *model, return ANEURALNETWORKS_NO_ERROR; } -int ANeuralNetworksModel_identifyInputsAndOutputs(ANeuralNetworksModel *model, - uint32_t inputCount, - const uint32_t *inputs, - uint32_t outputCount, +int ANeuralNetworksModel_identifyInputsAndOutputs(ANeuralNetworksModel *model, uint32_t inputCount, + const uint32_t *inputs, uint32_t outputCount, const uint32_t *outputs) { // NOTE ::internal::tflite::operand::Index uses int as its underlying type as various NNAPI @@ -261,10 +255,7 @@ int ANeuralNetworksModel_identifyInputsAndOutputs(ANeuralNetworksModel *model, return ANEURALNETWORKS_NO_ERROR; } -int ANeuralNetworksModel_finish(ANeuralNetworksModel *model) -{ - return ANEURALNETWORKS_NO_ERROR; -} +int ANeuralNetworksModel_finish(ANeuralNetworksModel *model) { return ANEURALNETWORKS_NO_ERROR; } // // ANeuralNetworksModel diff --git a/runtimes/pure_arm_compute/symbolcheck.cpp b/runtimes/pure_arm_compute/symbolcheck.cpp index fdfb05e..bc937d7 100644 --- a/runtimes/pure_arm_compute/symbolcheck.cpp +++ b/runtimes/pure_arm_compute/symbolcheck.cpp @@ -2,9 +2,10 @@ #include -#define SHOW_FUNC_ENTRY(name) { \ - std::cout << #name << " is at " << reinterpret_cast(name) << std::endl; \ -} +#define SHOW_FUNC_ENTRY(name) \ + { \ + std::cout << #name << " is at " << reinterpret_cast(name) << std::endl; \ + } int main(int argc, char **argv) { @@ -35,10 +36,10 @@ int main(int argc, char **argv) // NOTE Pure CL runtime does not implement following NN API(s) as // Tensorflow Lite does not use these API(s) - //SHOW_FUNC_ENTRY(ANeuralNetworksCompilation_free); - //SHOW_FUNC_ENTRY(ANeuralNetworksCompilation_setPreference); - //SHOW_FUNC_ENTRY(ANeuralNetworksExecution_setInputFromMemory); - //SHOW_FUNC_ENTRY(ANeuralNetworksExecution_setOutputFromMemory); + // SHOW_FUNC_ENTRY(ANeuralNetworksCompilation_free); + // SHOW_FUNC_ENTRY(ANeuralNetworksCompilation_setPreference); + // SHOW_FUNC_ENTRY(ANeuralNetworksExecution_setInputFromMemory); + // SHOW_FUNC_ENTRY(ANeuralNetworksExecution_setOutputFromMemory); return 0; } -- 2.7.4