From: SaeHie Park Date: Fri, 23 Mar 2018 00:52:47 +0000 (+0900) Subject: Fix bindacl experiment to run with acl graph layer X-Git-Tag: 0.1~612 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ad78aeae91092c1baad379c29b1cd0443a4758cf;p=platform%2Fcore%2Fml%2Fnnfw.git Fix bindacl experiment to run with acl graph layer This will fix bindacl failure and run with one SoftMaxLayer in the network --- diff --git a/experiments/bindacl/CMakeLists.txt b/experiments/bindacl/CMakeLists.txt index 6943137..d553352 100644 --- a/experiments/bindacl/CMakeLists.txt +++ b/experiments/bindacl/CMakeLists.txt @@ -6,13 +6,18 @@ set(NNAPI_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/tools/nnapi_bindings/include) # TODO: fix acl location set(ACL_DIR ${CMAKE_SOURCE_DIR}/externals/acl) +# These are not included in arm_compute libraries so add here +set(ACL_GRAPH_UTILS_SRCS ${ACL_DIR}/utils/GraphUtils.cpp + ${ACL_DIR}/utils/Utils.cpp) + set(ACL_INCLUDES ${ACL_DIR} ${ACL_DIR}/include) set(ACL_LIBS arm_compute_graph arm_compute arm_compute_core) link_directories(${CMAKE_INSTALL_PREFIX}/lib) -add_library(exp_bindacl SHARED ${NNAPI_BINDACL_SRCS}) +add_library(exp_bindacl SHARED ${NNAPI_BINDACL_SRCS} + ${ACL_GRAPH_UTILS_SRCS}) target_include_directories(exp_bindacl PUBLIC ${NNAPI_INCLUDE_DIR} ${ACL_INCLUDES}) target_link_libraries(exp_bindacl ${ACL_LIBS}) diff --git a/experiments/bindacl/src/nnapi_acl.cc b/experiments/bindacl/src/nnapi_acl.cc index 24a8bad..12731e3 100644 --- a/experiments/bindacl/src/nnapi_acl.cc +++ b/experiments/bindacl/src/nnapi_acl.cc @@ -7,6 +7,7 @@ #include // ACL Headers #include +#include #include #include @@ -152,24 +153,21 @@ ResultCode ANeuralNetworksExecution_create(ANeuralNetworksCompilation* compilati arm_compute::graph::Graph& graph = execlocal->graph; TargetHint target_hint; -#if 0 std::string image; std::string label; constexpr float mean_r = 122.68f; // Mean value to subtract from red channel constexpr float mean_g = 116.67f; // Mean value to subtract from green channel constexpr float mean_b = 104.01f; // Mean value to subtract from blue channel -#endif // 0 = NEON, 1 = OpenCL // arm_compute::graph_utils can't be used with 'using' target_hint = arm_compute::graph_utils::set_target_hint(1); graph << target_hint -#if 0 - // TODO: fix load library fail when get_input_accessor() is used << Tensor(TensorInfo(TensorShape(224U, 224U, 3U, 1U), 1, DataType::F32), arm_compute::graph_utils::get_input_accessor(image, mean_r, mean_g, mean_b)) -#endif + << arm_compute::graph::SoftmaxLayer() + << Tensor(arm_compute::graph_utils::get_output_accessor(label, 5)); ; std::cout << __FUNCTION__ << " ---" << std::endl; @@ -192,12 +190,10 @@ ResultCode ANeuralNetworksExecution_startCompute(ANeuralNetworksExecution* execu std::cout << __FUNCTION__ << " +++" << std::endl; *event = new ANeuralNetworksEvent; -#if 0 // graph.run() fails with segment fail when only target_hint is added. // after fix adding 'Tensor' we may call graph.run() arm_compute::graph::Graph& graph = execution->graph; graph.run(); -#endif std::cout << __FUNCTION__ << " ---" << std::endl; return ANEURALNETWORKS_NO_ERROR;