diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index a5c4dce..b704bc8 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -1 +1,2 @@ add_subdirectory(example) +add_subdirectory(layer_example) \ No newline at end of file diff --git a/app/example/CMakeLists.txt b/app/example/CMakeLists.txt index 033d285..5ac1ad8 100644 --- a/app/example/CMakeLists.txt +++ b/app/example/CMakeLists.txt @@ -1 +1 @@ -add_executable(example main.cpp) +add_executable(example main.cpp) \ No newline at end of file diff --git a/app/layer_example/CMakeLists.txt b/app/layer_example/CMakeLists.txt new file mode 100644 index 0000000..0dc37a2 --- /dev/null +++ b/app/layer_example/CMakeLists.txt @@ -0,0 +1,11 @@ +set(ARM_DIR "${CMAKE_SOURCE_DIR}/3rdparty/ComputeLibrary") + +add_executable(Split SplitLayer.cpp) + +include_directories(${ARM_DIR}) +include_directories(${ARM_DIR}/include) +target_link_directories(Split PUBLIC ${ARM_DIR}/build) + +target_link_libraries(Split arm_compute) + +add_dependencies(Split build_compute_library) \ No newline at end of file diff --git a/app/layer_example/SplitLayer.cpp b/app/layer_example/SplitLayer.cpp new file mode 100644 index 0000000..d02fd24 --- /dev/null +++ b/app/layer_example/SplitLayer.cpp @@ -0,0 +1,34 @@ +#include +#include "arm_compute/runtime/NEON/NEFunctions.h" +#include "utils/Utils.h" + +using namespace arm_compute; +using namespace utils; + +int main() { + Tensor input; + const int input_width = 3; + const int input_height = 3; + const int channels = 2; + const int axis = 2; + + input.allocator()->init(TensorInfo(TensorShape(input_width, input_height, channels), 1, DataType::F32)); + input.allocator()->allocate(); + fill_random_tensor(input, 0.f, 1.f); + + Tensor output1, output2; + std::vector outputs = { &output1, &output2 }; + + NESplit split; + split.configure(&input, outputs, axis); + + output1.allocator()->allocate(); + output2.allocator()->allocate(); + + split.run(); + + output1.print(std::cout); + output2.print(std::cout); + + return 0; +} \ No newline at end of file