From: sjsujinkim Date: Thu, 29 Mar 2018 04:53:44 +0000 (+0900) Subject: Implement Event_wait Event_free X-Git-Tag: 0.1~529 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=517573e900813c2267179450afbff76f5c9cb773;p=platform%2Fcore%2Fml%2Fnnfw.git Implement Event_wait Event_free This commit implements Event_wait, Event_free and enables android::sp in NeuralNetworks.cpp. Signed-off-by: sjsujinkim --- diff --git a/src/runtime/ref/nn/runtime/ExecutionBuilder.h b/src/runtime/ref/nn/runtime/ExecutionBuilder.h index f3fa138..08299b8 100644 --- a/src/runtime/ref/nn/runtime/ExecutionBuilder.h +++ b/src/runtime/ref/nn/runtime/ExecutionBuilder.h @@ -17,9 +17,7 @@ #ifndef ANDROID_ML_NN_RUNTIME_EXECUTION_BUILDER_H #define ANDROID_ML_NN_RUNTIME_EXECUTION_BUILDER_H -#if 0 // REF-ANN #include "Callbacks.h" -#endif #include "HalInterfaces.h" #include "Memory.h" #include "ModelBuilder.h" @@ -31,9 +29,9 @@ #include #if 0 // REF-ANN -using ::android::hardware::neuralnetworks::V1_0::implementation::ExecutionCallback; using ::android::hardware::neuralnetworks::V1_0::implementation::PreparedModelCallback; #endif +using ::android::hardware::neuralnetworks::V1_0::implementation::ExecutionCallback; namespace android { namespace nn { diff --git a/src/runtime/ref/nn/runtime/NeuralNetworks.cpp b/src/runtime/ref/nn/runtime/NeuralNetworks.cpp index bbf6a2e..5cad954 100644 --- a/src/runtime/ref/nn/runtime/NeuralNetworks.cpp +++ b/src/runtime/ref/nn/runtime/NeuralNetworks.cpp @@ -19,7 +19,7 @@ // that implements the functionality. #include "NeuralNetworks.h" - +#include "Callbacks.h" #include "CompilationBuilder.h" #include "ExecutionBuilder.h" #include "ModelBuilder.h" @@ -220,8 +220,8 @@ static_assert(static_cast(FusedActivationFunc::RELU1) == ANEURALNETWORK static_assert(static_cast(FusedActivationFunc::RELU6) == ANEURALNETWORKS_FUSED_RELU6, "FusedActivationFunc::RELU6 != ANEURALNETWORKS_FUSED_RELU6"); -using android::sp; #endif +using android::sp; using namespace android::nn; int ANeuralNetworksMemory_createFromFd(size_t size, int prot, int fd, size_t offset, @@ -503,11 +503,6 @@ int ANeuralNetworksExecution_startCompute(ANeuralNetworksExecution* execution, } int ANeuralNetworksEvent_wait(ANeuralNetworksEvent* event) { - // Dummy Implementation - return ANEURALNETWORKS_NO_ERROR; - - // Original code for reference -#if 0 if (event == nullptr) { LOG(ERROR) << "ANeuralNetworksEvent_wait passed a nullptr"; return ANEURALNETWORKS_UNEXPECTED_NULL; @@ -516,17 +511,13 @@ int ANeuralNetworksEvent_wait(ANeuralNetworksEvent* event) { sp* e = reinterpret_cast*>(event); (*e)->wait(); return ANEURALNETWORKS_NO_ERROR; -#endif } void ANeuralNetworksEvent_free(ANeuralNetworksEvent* event) { - // Original code for reference -#if 0 // No validation. Free of nullptr is valid. if (event) { sp* e = reinterpret_cast*>(event); (*e)->wait(); delete e; } -#endif }