├── requirements.txt ├── .cm ├── alias-a-soft ├── alias-u-5e1100048ab875d7 ├── alias-a-package ├── alias-a-program ├── alias-u-1dc07ee0f4742028 └── alias-u-b0ac08fe1d3c2615 ├── package ├── lib-armnn │ ├── .cm │ │ ├── desc.json │ │ ├── info.json │ │ └── meta.json │ ├── scripts.linux │ │ ├── post-install2.sh │ │ └── install.sh │ ├── patch.variations │ │ ├── rel.18.08_malloc-to-stdlib.patch │ │ ├── rel.19.08_no-werror.patch │ │ ├── rel.20.05_no-werror.patch │ │ ├── rel.19.05_install-tflite-parser.patch │ │ └── rel.20.05_hardswish.patch │ ├── README.md │ └── scripts.android │ │ └── install.sh ├── lib-armcl-viascons │ ├── .cm │ │ ├── desc.json │ │ ├── info.json │ │ └── meta.json │ ├── README.md │ ├── scripts.android │ │ └── install.sh │ └── scripts.linux │ │ └── install.sh ├── .cm │ ├── alias-a-lib-armnn │ ├── alias-u-f517b24b03b2b61f │ ├── alias-a-lib-armcl-viascons │ ├── alias-u-ca543728daba4dfd │ ├── alias-a-arm-software-ml-examples │ └── alias-u-7a108900c0de71c0 └── arm-software-ml-examples │ └── .cm │ ├── desc.json │ ├── info.json │ └── meta.json ├── soft ├── lib.armnn │ ├── .cm │ │ ├── desc.json │ │ ├── meta.json │ │ └── info.json │ └── customize.py ├── arm-ml-examples │ ├── .cm │ │ ├── desc.json │ │ ├── info.json │ │ └── meta.json │ └── customize.py └── .cm │ ├── alias-a-lib.armnn │ ├── alias-u-173fa76814bc9880 │ ├── alias-a-arm-ml-examples │ └── alias-u-41ea42ff728bfb59 ├── program ├── mnist-armnn-tf │ ├── .cm │ │ ├── desc.json │ │ ├── info.json │ │ └── meta.json │ ├── README.md │ ├── mnist_loader.hpp │ ├── mnist_tf.cpp │ └── LICENSE ├── simplesample │ ├── .cm │ │ ├── desc.json │ │ ├── info.json │ │ └── meta.json │ └── SimpleSample.cpp └── .cm │ ├── alias-a-simplesample │ ├── alias-u-f34d649b8bbb846a │ ├── alias-a-mnist-armnn-tf │ └── alias-u-dee85e62d40959a9 ├── COPYRIGHT.txt ├── .gitignore ├── .ckr.json ├── README.md ├── LICENSE.txt └── .travis.yml /requirements.txt: -------------------------------------------------------------------------------- 1 | ck 2 | -------------------------------------------------------------------------------- /.cm/alias-a-soft: -------------------------------------------------------------------------------- 1 | 5e1100048ab875d7 2 | -------------------------------------------------------------------------------- /.cm/alias-u-5e1100048ab875d7: -------------------------------------------------------------------------------- 1 | soft 2 | -------------------------------------------------------------------------------- /package/lib-armnn/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /soft/lib.armnn/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /.cm/alias-a-package: -------------------------------------------------------------------------------- 1 | 1dc07ee0f4742028 2 | -------------------------------------------------------------------------------- /.cm/alias-a-program: -------------------------------------------------------------------------------- 1 | b0ac08fe1d3c2615 2 | -------------------------------------------------------------------------------- /.cm/alias-u-1dc07ee0f4742028: -------------------------------------------------------------------------------- 1 | package 2 | -------------------------------------------------------------------------------- /.cm/alias-u-b0ac08fe1d3c2615: -------------------------------------------------------------------------------- 1 | program 2 | -------------------------------------------------------------------------------- /program/mnist-armnn-tf/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /program/simplesample/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /soft/arm-ml-examples/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /package/lib-armcl-viascons/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /soft/.cm/alias-a-lib.armnn: -------------------------------------------------------------------------------- 1 | 173fa76814bc9880 2 | -------------------------------------------------------------------------------- /soft/.cm/alias-u-173fa76814bc9880: -------------------------------------------------------------------------------- 1 | lib.armnn 2 | -------------------------------------------------------------------------------- /package/.cm/alias-a-lib-armnn: -------------------------------------------------------------------------------- 1 | f517b24b03b2b61f 2 | -------------------------------------------------------------------------------- /package/.cm/alias-u-f517b24b03b2b61f: -------------------------------------------------------------------------------- 1 | lib-armnn 2 | -------------------------------------------------------------------------------- /package/arm-software-ml-examples/.cm/desc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /program/.cm/alias-a-simplesample: -------------------------------------------------------------------------------- 1 | f34d649b8bbb846a 2 | -------------------------------------------------------------------------------- /program/.cm/alias-u-f34d649b8bbb846a: -------------------------------------------------------------------------------- 1 | simplesample 2 | -------------------------------------------------------------------------------- /soft/.cm/alias-a-arm-ml-examples: -------------------------------------------------------------------------------- 1 | 41ea42ff728bfb59 2 | -------------------------------------------------------------------------------- /soft/.cm/alias-u-41ea42ff728bfb59: -------------------------------------------------------------------------------- 1 | arm-ml-examples 2 | -------------------------------------------------------------------------------- /program/.cm/alias-a-mnist-armnn-tf: -------------------------------------------------------------------------------- 1 | dee85e62d40959a9 2 | -------------------------------------------------------------------------------- /program/.cm/alias-u-dee85e62d40959a9: -------------------------------------------------------------------------------- 1 | mnist-armnn-tf 2 | -------------------------------------------------------------------------------- /package/.cm/alias-a-lib-armcl-viascons: -------------------------------------------------------------------------------- 1 | ca543728daba4dfd 2 | -------------------------------------------------------------------------------- /package/.cm/alias-u-ca543728daba4dfd: -------------------------------------------------------------------------------- 1 | lib-armcl-viascons 2 | -------------------------------------------------------------------------------- /package/.cm/alias-a-arm-software-ml-examples: -------------------------------------------------------------------------------- 1 | 7a108900c0de71c0 2 | -------------------------------------------------------------------------------- /package/.cm/alias-u-7a108900c0de71c0: -------------------------------------------------------------------------------- 1 | arm-software-ml-examples 2 | -------------------------------------------------------------------------------- /COPYRIGHT.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2019 cTuning foundation. 2 | Copyright (c) 2020 dividiti Limited. 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *tmp/ 3 | *tmp-ck-*/ 4 | *.pyc 5 | *_tmp.json 6 | .ipynb_checkpoints/ 7 | preprocessed/ 8 | -------------------------------------------------------------------------------- /soft/arm-ml-examples/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "41ea42ff728bfb59", 3 | "backup_module_uid": "5e1100048ab875d7", 4 | "backup_module_uoa": "soft", 5 | "control": { 6 | "engine": "CK", 7 | "iso_datetime": "2019-02-13T02:57:52.994291", 8 | "version": [ 9 | "0", 10 | "0", 11 | "1", 12 | "0" 13 | ] 14 | }, 15 | "data_name": "arm-ml-examples" 16 | } 17 | -------------------------------------------------------------------------------- /package/lib-armnn/scripts.linux/post-install2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Make sure we can reach our libraries via lib/ even if they were originally put into lib64/ 4 | 5 | if [ -d "$INSTALL_DIR/install/lib64" ]; then 6 | 7 | if ! [ -d "$INSTALL_DIR/install/lib" ]; then 8 | mkdir ${INSTALL_DIR}/install/lib 9 | fi 10 | 11 | cp -r ${INSTALL_DIR}/install/lib64/* ${INSTALL_DIR}/install/lib 12 | fi 13 | -------------------------------------------------------------------------------- /package/arm-software-ml-examples/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "7a108900c0de71c0", 3 | "backup_module_uid": "1dc07ee0f4742028", 4 | "backup_module_uoa": "package", 5 | "control": { 6 | "engine": "CK", 7 | "iso_datetime": "2019-02-13T02:30:51.750650", 8 | "version": [ 9 | "0", 10 | "0", 11 | "1", 12 | "0" 13 | ] 14 | }, 15 | "data_name": "arm-software-ml-examples" 16 | } 17 | -------------------------------------------------------------------------------- /.ckr.json: -------------------------------------------------------------------------------- 1 | { 2 | "data_uoa": "ck-armnn", 3 | "data_uid": "6b043a091334106b", 4 | "data_alias": "ck-armnn", 5 | "data_name": "ck-armnn", 6 | "dict": { 7 | "shared": "git", 8 | "url": "https://github.com/dividiti/ck-armnn.git", 9 | "repo_deps": [ 10 | { 11 | "repo_uoa": "ck-math" 12 | }, 13 | { 14 | "repo_uoa": "ck-tensorflow", 15 | "repo_url": "https://github.com/dividiti/ck-tensorflow" 16 | } 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /soft/arm-ml-examples/.cm/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "auto_detect": "yes", 3 | "customize": { 4 | "check_that_exists": "yes", 5 | "ck_version": 10, 6 | "env_prefix": "CK_ENV_ARMNN_EXAMPLES", 7 | "limit_recursion_dir_search": { 8 | "linux": 5 9 | }, 10 | "soft_file": { 11 | "linux": "armnn-mnist/README.md" 12 | } 13 | }, 14 | "soft_name": "ArmNN model and dataset", 15 | "tags": [ 16 | "armnn", 17 | "model", 18 | "dataset" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /package/lib-armnn/patch.variations/rel.18.08_malloc-to-stdlib.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/armnn/test/FloatingPointConverterTest.cpp b/src/armnn/test/FloatingPointConverterTest.cpp 2 | index 9299b90..02aaeab 100644 3 | --- a/src/armnn/test/FloatingPointConverterTest.cpp 4 | +++ b/src/armnn/test/FloatingPointConverterTest.cpp 5 | @@ -6,7 +6,7 @@ 6 | #include "FloatingPointConverter.hpp" 7 | #include 8 | 9 | -#include 10 | +#include 11 | #include 12 | #include 13 | 14 | -------------------------------------------------------------------------------- /soft/lib.armnn/.cm/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "auto_detect": "yes", 3 | "customize": { 4 | "check_that_exists": "yes", 5 | "ck_version": 10, 6 | "dynamic_lib": "libarmnn.so", 7 | "env_prefix": "CK_ENV_LIB_ARMNN", 8 | "file_root_name": "libarmnn", 9 | "limit_recursion_dir_search": { 10 | "linux": 4, 11 | "win": 4 12 | }, 13 | "soft_file": { 14 | "linux": "libarmnn$#file_ext_dll#$" 15 | }, 16 | "soft_path_example": { 17 | "linux": "/usr/local/lib/libarmnn.so" 18 | } 19 | }, 20 | "deps": {}, 21 | "soft_name": "ArmNN library", 22 | "tags": [ 23 | "lib", 24 | "armnn" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /program/simplesample/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "f34d649b8bbb846a", 3 | "backup_module_uid": "b0ac08fe1d3c2615", 4 | "backup_module_uoa": "program", 5 | "control": { 6 | "author": "cTuning foundation", 7 | "author_email": "admin@cTuning.org", 8 | "author_webpage": "http://cTuning.org", 9 | "copyright": "See CK COPYRIGHT.txt for copyright details", 10 | "engine": "CK", 11 | "iso_datetime": "2019-02-12T01:56:32.028597", 12 | "license": "See CK LICENSE.txt for licensing details", 13 | "version": [ 14 | "0", 15 | "0", 16 | "1", 17 | "0" 18 | ] 19 | }, 20 | "data_name": "simplesample" 21 | } 22 | -------------------------------------------------------------------------------- /soft/lib.armnn/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "173fa76814bc9880", 3 | "backup_module_uid": "5e1100048ab875d7", 4 | "backup_module_uoa": "soft", 5 | "control": { 6 | "author": "cTuning foundation", 7 | "author_email": "admin@cTuning.org", 8 | "author_webpage": "http://cTuning.org", 9 | "copyright": "See CK COPYRIGHT.txt for copyright details", 10 | "engine": "CK", 11 | "iso_datetime": "2019-02-07T17:28:53.415950", 12 | "license": "See CK LICENSE.txt for licensing details", 13 | "version": [ 14 | "1", 15 | "9", 16 | "6", 17 | "1" 18 | ] 19 | }, 20 | "data_name": "lib.armnn" 21 | } 22 | -------------------------------------------------------------------------------- /package/lib-armnn/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "f517b24b03b2b61f", 3 | "backup_module_uid": "1dc07ee0f4742028", 4 | "backup_module_uoa": "package", 5 | "control": { 6 | "author": "cTuning foundation", 7 | "author_email": "admin@cTuning.org", 8 | "author_webpage": "http://cTuning.org", 9 | "copyright": "See CK COPYRIGHT.txt for copyright details", 10 | "engine": "CK", 11 | "iso_datetime": "2019-02-07T17:30:10.676379", 12 | "license": "See CK LICENSE.txt for licensing details", 13 | "version": [ 14 | "1", 15 | "9", 16 | "6", 17 | "1" 18 | ] 19 | }, 20 | "data_name": "lib-armnn" 21 | } 22 | -------------------------------------------------------------------------------- /program/mnist-armnn-tf/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "dee85e62d40959a9", 3 | "backup_module_uid": "b0ac08fe1d3c2615", 4 | "backup_module_uoa": "program", 5 | "control": { 6 | "author": "cTuning foundation", 7 | "author_email": "admin@cTuning.org", 8 | "author_webpage": "http://cTuning.org", 9 | "copyright": "See CK COPYRIGHT.txt for copyright details", 10 | "engine": "CK", 11 | "iso_datetime": "2019-02-12T07:54:03.865611", 12 | "license": "See CK LICENSE.txt for licensing details", 13 | "version": [ 14 | "0", 15 | "0", 16 | "1", 17 | "0" 18 | ] 19 | }, 20 | "data_name": "mnist-armnn-tf" 21 | } 22 | -------------------------------------------------------------------------------- /package/lib-armcl-viascons/.cm/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "ca543728daba4dfd", 3 | "backup_module_uid": "1dc07ee0f4742028", 4 | "backup_module_uoa": "package", 5 | "control": { 6 | "author": "cTuning foundation", 7 | "author_email": "admin@cTuning.org", 8 | "author_webpage": "http://cTuning.org", 9 | "copyright": "See CK COPYRIGHT.txt for copyright details", 10 | "engine": "CK", 11 | "iso_datetime": "2019-02-08T19:51:36.136818", 12 | "license": "See CK LICENSE.txt for licensing details", 13 | "version": [ 14 | "1", 15 | "9", 16 | "6", 17 | "1" 18 | ] 19 | }, 20 | "data_name": "lib-armcl-viascons" 21 | } 22 | -------------------------------------------------------------------------------- /package/lib-armnn/patch.variations/rel.19.08_no-werror.patch: -------------------------------------------------------------------------------- 1 | diff --git a/cmake/GlobalConfig.cmake b/cmake/GlobalConfig.cmake 2 | index 0476f40..3579614 100644 3 | --- a/cmake/GlobalConfig.cmake 4 | +++ b/cmake/GlobalConfig.cmake 5 | @@ -51,7 +51,7 @@ endif() 6 | # Compiler flags that are always set 7 | set(CMAKE_POSITION_INDEPENDENT_CODE ON) 8 | if(COMPILER_IS_GNU_LIKE) 9 | - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Werror -Wold-style-cast -Wno-missing-braces -Wconversion -Wsign-conversion") 10 | + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wold-style-cast -Wno-missing-braces -Wconversion -Wsign-conversion") 11 | elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC) 12 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /MP") 13 | add_definitions(-DNOMINMAX=1 -DNO_STRICT=1) 14 | -------------------------------------------------------------------------------- /package/lib-armnn/patch.variations/rel.20.05_no-werror.patch: -------------------------------------------------------------------------------- 1 | diff --git a/cmake/GlobalConfig.cmake b/cmake/GlobalConfig.cmake 2 | index 650d4091..586352f9 100644 3 | --- a/cmake/GlobalConfig.cmake 4 | +++ b/cmake/GlobalConfig.cmake 5 | @@ -65,7 +65,7 @@ endif() 6 | # Compiler flags that are always set 7 | set(CMAKE_POSITION_INDEPENDENT_CODE ON) 8 | if(COMPILER_IS_GNU_LIKE) 9 | - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra -Werror -Wold-style-cast -Wno-missing-braces -Wconversion -Wsign-conversion") 10 | + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra -Wold-style-cast -Wno-missing-braces -Wconversion -Wsign-conversion") 11 | elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC) 12 | # Disable C4996 (use of deprecated identifier) due to https://developercommunity.visualstudio.com/content/problem/252574/deprecated-compilation-warning-for-virtual-overrid.html 13 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /MP /wd4996") 14 | -------------------------------------------------------------------------------- /package/arm-software-ml-examples/.cm/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "check_exit_status": "yes", 3 | "customize": { 4 | "install_env": { 5 | "PACKAGE_GIT": "YES", 6 | "PACKAGE_SKIP_LINUX_MAKE": "YES", 7 | "PACKAGE_URL": "https://github.com/ARM-software/ML-examples.git" 8 | }, 9 | "no_os_in_suggested_path": "yes", 10 | "no_ver_in_suggested_path": "no", 11 | "version": "master" 12 | }, 13 | "end_full_path": { 14 | "linux": "ML-examples/armnn-mnist/model/simple_mnist_tf.prototxt" 15 | }, 16 | "only_for_host_os_tags": [ 17 | "linux" 18 | ], 19 | "only_for_target_os_tags": [ 20 | "linux" 21 | ], 22 | "process_script": "install", 23 | "soft_uoa": "41ea42ff728bfb59", 24 | "suggested_path": "arm-software-ml-examples", 25 | "tags": [ 26 | "armnn", 27 | "dataset", 28 | "model" 29 | ], 30 | "use_scripts_from_another_entry": { 31 | "data_uoa": "cd9ccc74060b3d18", 32 | "module_uoa": "script" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /package/lib-armnn/patch.variations/rel.19.05_install-tflite-parser.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/armnnSerializer/CMakeLists.txt b/src/armnnSerializer/CMakeLists.txt 2 | index bca36f9..a7f85ec 100755 3 | --- a/src/armnnSerializer/CMakeLists.txt 4 | +++ b/src/armnnSerializer/CMakeLists.txt 5 | @@ -34,4 +34,7 @@ if(BUILD_ARMNN_SERIALIZER) 6 | target_include_directories(armnnSerializer SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) 7 | 8 | target_link_libraries(armnnSerializer armnn ${FLATBUFFERS_LIBRARY}) 9 | -endif() 10 | \ No newline at end of file 11 | + 12 | + install(TARGETS armnnSerializer 13 | + LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) 14 | +endif() 15 | diff --git a/src/armnnTfLiteParser/CMakeLists.txt b/src/armnnTfLiteParser/CMakeLists.txt 16 | index 2a6a0a1..8ff0837 100755 17 | --- a/src/armnnTfLiteParser/CMakeLists.txt 18 | +++ b/src/armnnTfLiteParser/CMakeLists.txt 19 | @@ -20,4 +20,7 @@ if(BUILD_TF_LITE_PARSER) 20 | 21 | target_link_libraries(armnnTfLiteParser ${Boost_FILESYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY}) 22 | target_link_libraries(armnnTfLiteParser armnn ${FLATBUFFERS_LIBRARY}) 23 | -endif() 24 | \ No newline at end of file 25 | + 26 | + install(TARGETS armnnTfLiteParser 27 | + LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) 28 | +endif() 29 | -------------------------------------------------------------------------------- /program/mnist-armnn-tf/README.md: -------------------------------------------------------------------------------- 1 | # MNIST classification example for ArmNN/TF 2 | 3 | ## Compile (4 versions) : 4 | 5 | ``` 6 | $ ck compile program:mnist-armnn-tf # compile reference implementation (works on Intel) 7 | 8 | $ ck compile program:mnist-armnn-tf --env.USE_NEON # compile for using CPU acceleration (Arm only) 9 | 10 | $ ck compile program:mnist-armnn-tf --env.USE_OPENCL # compile for using GPU acceleration (Arm only) 11 | 12 | $ ck compile program:mnist-armnn-tf --env.USE_NEON --env.USE_OPENCL # compile for using both CPU and GPU acceleration 13 | ``` 14 | 15 | ## Run (4 versions, should match `USE_*` parameters during compilation) : 16 | 17 | ``` 18 | $ ck run program:mnist-armnn-tf --env.CK_FILE_NUMBER=0 # run reference implementation (works on Intel) 19 | 20 | $ ck run program:mnist-armnn-tf --env.USE_NEON # run for using CPU acceleration (Arm only) 21 | 22 | $ ck run program:mnist-armnn-tf --env.USE_OPENCL --env.CK_FILE_NUMBER=0 # run for using GPU acceleration (Arm only) 23 | 24 | $ ck run program:mnist-armnn-tf --env.USE_NEON --env.USE_OPENCL # run for using both CPU and GPU acceleration 25 | ``` 26 | 27 | ## Note: 28 | 29 | `CK_FILE_NUMBER` is the file number in MNIST dataset (0..9999) 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Travis Build Status](https://travis-ci.org/ctuning/ck-armnn.svg?branch=master)](https://travis-ci.org/ctuning/ck-armnn) 2 | 3 | *This fork is maintained by [dividiti Limited](https://dividiti.com).* 4 | 5 | # ArmNN installation 6 | 7 | To install a particular version of ArmNN we have to combine three kinds of tags: 8 | 9 | - Frontend-related tags (based on supported ArmNN parsers): `tf`, `tflite`, `onnx`. These can be combined. 10 | 11 | - Backend-related tags (based on a specific build of ArmCL): `neon`, `opencl`. These can be combined or both missing (reference). 12 | 13 | - Version/Release-related tags: `rel.20.08` (a particular frozen release), `release` (the latest stable release), `dev` (the live development branch). These are mutually exclusive. Exactly one Version/Release tag must be present. 14 | 15 | ## Examples 16 | 17 | The live development version supporting the TFLite frontend and Neon backend: 18 | ``` 19 | $ ck install package --tags=lib,armnn,tflite,neon,dev 20 | ``` 21 | 22 | The latest stable release supporting the TensorFlow frontend and OpenCL backend: 23 | ``` 24 | $ ck install package --tags=lib,armnn,tf,opencl,release 25 | ``` 26 | 27 | The 20.08 release supporting the TFLite and ONNX frontends and no optimized backends (i.e. reference): 28 | ``` 29 | $ ck install package --tags=lib,armnn,tflite,onnx,rel.20.08 30 | ``` 31 | -------------------------------------------------------------------------------- /package/lib-armcl-viascons/README.md: -------------------------------------------------------------------------------- 1 | # CK package for Arm Compute Library 2 | 3 | ## This package builds and installs a desired version of Arm CL using SCons 4 | 5 | Selection of the desired release and desired backend support is now done via combining relevant tags. 6 | 7 | ### Release tags: 8 | 9 | Please select exactly one of the following: { `release` | `rel.18.08` | `rel.18.11` | `rel.19.02` | `rel.19.05` | `dev` } 10 | 11 | ### Backend (CPU and GPU acceleration) tags: 12 | 13 | Please select any combination, possibly empty, of the following: { `neon` , `opencl` } 14 | 15 | 16 | ## Examples: 17 | ``` 18 | ck install package --tags=lib,armcl,viascons,rel.18.11 # Release 18.11 without acceleration (reference implementation) 19 | 20 | ck install package --tags=lib,armcl,viascons,rel.19.02,neon # Release 19.02 with CPU acceleration 21 | 22 | ck install package --tags=lib,armcl,viascons,release,opencl # Current release with GPU acceleration 23 | 24 | ck install package --tags=lib,armcl,viascons,dev,neon,opencl # Current development with CPU and GPU acceleration 25 | ``` 26 | 27 | ## Note: 28 | 29 | If you are intending to simultaneously maintain same-release versions with and without `neon`/`opencl` support, start compiling ones without the support, gradually adding these capabilities. It is currently a known CK constraint that a new package should not be added with a subset of tags of another currently installed environment. 30 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2019 cTuning foundation . 2 | Copyright (c) 2020 dividiti Limited . 3 | All rights reserved 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | 3. Neither the name of the cTuning foundation 16 | nor the names of its contributors may be used to endorse 17 | or promote products derived from this software without 18 | specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 27 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /program/mnist-armnn-tf/.cm/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "pass_env_to_resolve": "yes", 3 | "backup_data_uid": "dee85e62d40959a9", 4 | "compile_deps": { 5 | "compiler": { 6 | "local": "yes", 7 | "name": "C++ compiler", 8 | "sort": 10, 9 | "tags": "compiler,lang-cpp" 10 | }, 11 | "lib-armnn": { 12 | "local": "yes", 13 | "name": "ArmNN library", 14 | "sort": 20, 15 | "tags": "lib,armnn,tf", 16 | "update_tags_if_env" : { 17 | "neon": [ { "USE_NEON": ["on", "ON", "yes", "YES", "1"] } ], 18 | "opencl": [ { "USE_OPENCL": ["on", "ON", "yes", "YES", "1"] } ] 19 | } 20 | } 21 | }, 22 | "compiler_env": "CK_CXX_FULL_PATH", 23 | "compiler_flags_as_env": "$<>$ $<>$", 24 | "data_name": "mnist-armnn-tf", 25 | "extra_ld_vars": "$<>$ -L$<>$ -larmnn -lpthread -larmnnTfParser", 26 | "main_language": "cpp", 27 | "only_for_target_os_tags": [ 28 | "linux", 29 | "windows" 30 | ], 31 | "process_in_tmp": "yes", 32 | "program": "yes", 33 | "run_cmds": { 34 | "minimal": { 35 | "run_time": { 36 | "run_cmd_main": "$#BIN_FILE#$ $<>$ $<>$ $<>$" 37 | } 38 | } 39 | }, 40 | "run_deps": { 41 | "arm-examples": { 42 | "local": "yes", 43 | "name": "Arm software examples", 44 | "sort": 10, 45 | "tags": "armnn,model,dataset" 46 | } 47 | }, 48 | "run_vars": { 49 | "USE_NEON": "NO", 50 | "USE_OPENCL": "NO", 51 | "CK_FILE_NUMBER": 0 52 | }, 53 | "source_files": [ 54 | "mnist_tf.cpp" 55 | ], 56 | "tags": [ 57 | "test", 58 | "mnist", 59 | "tf", 60 | "armnn", 61 | "lang-cpp" 62 | ], 63 | "target_file": "mnist" 64 | } 65 | -------------------------------------------------------------------------------- /package/lib-armcl-viascons/scripts.android/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # See CK LICENSE.txt for licensing details. 5 | # See CK COPYRIGHT.txt for copyright details. 6 | # 7 | # Developer(s): 8 | # - Leo Gordon, 2019 9 | # 10 | 11 | # for example, 12 | # INSTALL_DIR = "lib-armcl-viascons-linux-64" 13 | # PACKAGE_SUB_DIR = "src" 14 | 15 | ARMCL_SOURCE_DIR=$INSTALL_DIR/$PACKAGE_SUB_DIR 16 | 17 | ############################################################ 18 | echo "" 19 | echo "Building ArmCL '${PACKAGE_VERSION}' in '${INSTALL_DIR}' using SCons with ${CK_HOST_CPU_NUMBER_OF_PROCESSORS:-UndefinedNumberOf} threads." 20 | echo "Backends: USE_NEON='${USE_NEON}'; USE_OPENCL='${USE_OPENCL}'." 21 | echo "" 22 | 23 | if [ "$USE_NEON" == "ON" ] || [ "$USE_NEON" == "on" ] || [ "$USE_NEON" == "YES" ] || [ "$USE_NEON" == "yes" ] || [ "$USE_NEON" == "1" ] 24 | then 25 | ARMCL_SCONS_INTERNAL_NEON="neon=1" 26 | else 27 | ARMCL_SCONS_INTERNAL_NEON="" 28 | fi 29 | 30 | if [ "$USE_OPENCL" == "ON" ] || [ "$USE_OPENCL" == "on" ] || [ "$USE_OPENCL" == "YES" ] || [ "$USE_OPENCL" == "yes" ] || [ "$USE_OPENCL" == "1" ] 31 | then 32 | ARMCL_SCONS_INTERNAL_OPENCL="opencl=1 embed_kernels=1" 33 | else 34 | ARMCL_SCONS_INTERNAL_OPENCL="" 35 | fi 36 | 37 | cd ${ARMCL_SOURCE_DIR} 38 | 39 | if [ "$CK_COMPILER_TOOLCHAIN_NAME" == "clang" ] 40 | then 41 | CC="clang" 42 | CXX="clang++" 43 | else 44 | CC="${CK_CC}" 45 | CXX="${CK_CXX}" 46 | fi 47 | 48 | scons -j ${CK_HOST_CPU_NUMBER_OF_PROCESSORS:-1} \ 49 | arch=arm64-v8a \ 50 | extra_cxx_flags="-fPIC" \ 51 | build="cross_compile" \ 52 | os="android" \ 53 | toolchain_prefix="${CK_ENV_STANDALONE_TOOLCHAIN_ROOT}/bin/aarch64-linux-android-" \ 54 | benchmark_tests=0 \ 55 | validation_tests=0 \ 56 | examples=0 \ 57 | ${ARMCL_SCONS_INTERNAL_NEON} ${ARMCL_SCONS_INTERNAL_OPENCL} \ 58 | install_dir=$INSTALL_DIR/install 59 | -------------------------------------------------------------------------------- /package/lib-armcl-viascons/scripts.linux/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # See CK LICENSE.txt for licensing details. 5 | # See CK COPYRIGHT.txt for copyright details. 6 | # 7 | # Developer(s): 8 | # - Leo Gordon, 2019 9 | # 10 | 11 | # for example, 12 | # INSTALL_DIR = "lib-armcl-viascons-linux-64" 13 | # PACKAGE_SUB_DIR = "src" 14 | 15 | ARMCL_SOURCE_DIR=$INSTALL_DIR/$PACKAGE_SUB_DIR 16 | 17 | # Configure target. 18 | MACHINE=$(uname -m) 19 | if [ "${MACHINE}" == "armv7l" ] || [ "${CK_TARGET_CPU_BITS}" == "32" ]; then 20 | ARCH="armv7a" 21 | elif [ "${MACHINE}" == "aarch64" ]; then 22 | ARCH="arm64-v8a" 23 | else 24 | ARCH="arm64-v8a" 25 | echo "Warning: Unknown machine type: ${MACHINE}." 26 | fi 27 | 28 | ############################################################ 29 | echo "" 30 | echo "Building ArmCL '${PACKAGE_VERSION}' in '${INSTALL_DIR}' using SCons with ${CK_HOST_CPU_NUMBER_OF_PROCESSORS:-UndefinedNumberOf} threads." 31 | echo "Backends: USE_NEON='${USE_NEON}'; USE_OPENCL='${USE_OPENCL}'." 32 | echo "Target: arch=${ARCH}." 33 | echo "" 34 | 35 | if [ "$USE_NEON" == "ON" ] || [ "$USE_NEON" == "on" ] || [ "$USE_NEON" == "YES" ] || [ "$USE_NEON" == "yes" ] || [ "$USE_NEON" == "1" ] 36 | then 37 | ARMCL_SCONS_INTERNAL_NEON="neon=1" 38 | else 39 | ARMCL_SCONS_INTERNAL_NEON="" 40 | fi 41 | 42 | if [ "$USE_OPENCL" == "ON" ] || [ "$USE_OPENCL" == "on" ] || [ "$USE_OPENCL" == "YES" ] || [ "$USE_OPENCL" == "yes" ] || [ "$USE_OPENCL" == "1" ] 43 | then 44 | ARMCL_SCONS_INTERNAL_OPENCL="opencl=1 embed_kernels=1" 45 | else 46 | ARMCL_SCONS_INTERNAL_OPENCL="" 47 | fi 48 | 49 | 50 | cd ${ARMCL_SOURCE_DIR} 51 | CC=${CK_CC} CXX=${CK_CXX} scons -j ${CK_HOST_CPU_NUMBER_OF_PROCESSORS:-1} \ 52 | arch=${ARCH} toolchain_prefix=" " \ 53 | extra_cxx_flags="-fPIC" \ 54 | debug=0 asserts=0 \ 55 | benchmark_tests=0 \ 56 | validation_tests=0 \ 57 | ${ARMCL_SCONS_INTERNAL_NEON} ${ARMCL_SCONS_INTERNAL_OPENCL} \ 58 | install_dir=${INSTALL_DIR}/install 59 | -------------------------------------------------------------------------------- /soft/arm-ml-examples/customize.py: -------------------------------------------------------------------------------- 1 | # 2 | # Collective Knowledge (individual environment - setup) 3 | # 4 | # See CK LICENSE.txt for licensing details 5 | # See CK COPYRIGHT.txt for copyright details 6 | # 7 | 8 | import os 9 | 10 | ############################################################################## 11 | # setup environment setup 12 | def setup(i): 13 | """ 14 | Input: { 15 | cfg - meta of this soft entry 16 | self_cfg - meta of module soft 17 | ck_kernel - import CK kernel module (to reuse functions) 18 | 19 | host_os_uoa - host OS UOA 20 | host_os_uid - host OS UID 21 | host_os_dict - host OS meta 22 | 23 | target_os_uoa - target OS UOA 24 | target_os_uid - target OS UID 25 | target_os_dict - target OS meta 26 | 27 | target_device_id - target device ID (if via ADB) 28 | 29 | tags - list of tags used to search this entry 30 | 31 | env - updated environment vars from meta 32 | customize - updated customize vars from meta 33 | 34 | deps - resolved dependencies for this soft 35 | 36 | interactive - if 'yes', can ask questions, otherwise quiet 37 | } 38 | 39 | Output: { 40 | return - return code = 0, if successful 41 | > 0, if error 42 | (error) - error text if return > 0 43 | 44 | bat - prepared string for bat file 45 | } 46 | 47 | """ 48 | 49 | env = i['env'] 50 | cus = i.get('customize',{}) 51 | ep = cus['env_prefix'] 52 | 53 | full_path = cus.get('full_path','') 54 | model_dir = os.path.dirname(full_path) 55 | app_dir = os.path.dirname(model_dir) 56 | data_dir = os.path.join(app_dir, 'data') 57 | 58 | env[ep] = app_dir 59 | env[ep+'_MODEL'] = full_path 60 | env[ep+'_DATA'] = data_dir 61 | 62 | return {'return': 0, 'bat': ''} 63 | 64 | -------------------------------------------------------------------------------- /package/lib-armnn/README.md: -------------------------------------------------------------------------------- 1 | # CK package for ArmNN library 2 | 3 | ## This package builds and installs a desired version of ArmNN library 4 | 5 | Selection of the desired release, desired frontend support and desired backend is now done via combining relevant tags. 6 | 7 | ### Release tags: 8 | 9 | Please select exactly one of the following: { `release` | `rel.18.08` | `rel.18.11` | `rel.19.02` | `rel.19.05` | `dev` } 10 | 11 | ### Frontend tags: 12 | 13 | Please select any combination, but at least one, of the following: { `tf` , `tflite`, `onnx` } 14 | 15 | ### Backend (CPU and GPU acceleration) tags: 16 | 17 | Please select any combination, possibly empty, of the following: { `neon` , `opencl` } 18 | 19 | 20 | ## Examples: 21 | ``` 22 | ck install package --tags=lib,armnn,rel.18.08,tf # Release 18.08, TF frontend, no acceleration (reference implementation) 23 | 24 | ck install package --tags=lib,armnn,rel.19.05,tf,tflite,neon # Release 19.05, TF and TFLite frontends, CPU acceleration 25 | 26 | ck install package --tags=lib,armnn,release,tf,onnx,opencl # Current release, TF and ONNX frontends, GPU acceleration 27 | 28 | ck install package --tags=lib,armnn,dev,tflite,neon,opencl # Current development, TFLite frontend, CPU and GPU acceleration 29 | ``` 30 | 31 | ## Notes: 32 | 33 | 1. Asking for a non-trivial backend support (either `neon`, `opencl` or both) will automatically trigger building of the same-release version of ArmCL. This should only be attempted on an Arm platform (whereas a "backendless" version should compile and run on an Intel platform as well). 34 | 35 | 2. If you are intending to simultaneously maintain same-release versions with and without `neon`/`opencl` support, start compiling ones without the support, gradually adding these capabilities. It is currently a known CK constraint that a new package should not be added with a subset of tags of another currently installed environment. 36 | 37 | 3. The same applies to same-release versions with and without specific frontends: if you want to have them simultaneously, make sure you never build a subset of tags after you've built its proper superset. 38 | -------------------------------------------------------------------------------- /program/simplesample/SimpleSample.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2017 Arm Ltd. All rights reserved. 3 | // SPDX-License-Identifier: MIT 4 | // 5 | #include 6 | #include "armnn/ArmNN.hpp" 7 | 8 | /// A simple example of using the ArmNN SDK API. In this sample, the users single input number is multiplied by 1.0f 9 | /// using a fully connected layer with a single neuron to produce an output number that is the same as the input. 10 | int main() 11 | { 12 | using namespace armnn; 13 | 14 | float number; 15 | std::cout << "Please enter a number: " << std::endl; 16 | std::cin >> number; 17 | 18 | // Construct ArmNN network 19 | armnn::NetworkId networkIdentifier; 20 | INetworkPtr myNetwork = INetwork::Create(); 21 | 22 | armnn::FullyConnectedDescriptor fullyConnectedDesc; 23 | float weightsData[] = {1.0f}; // Identity 24 | TensorInfo weightsInfo(TensorShape({1, 1}), DataType::Float32); 25 | armnn::ConstTensor weights(weightsInfo, weightsData); 26 | IConnectableLayer *fullyConnected = myNetwork->AddFullyConnectedLayer(fullyConnectedDesc, 27 | weights, 28 | // EmptyOptional(), // rel.19.05 prefers this line, but rel.19.02 does not yet support it 29 | "fully connected"); 30 | 31 | IConnectableLayer *InputLayer = myNetwork->AddInputLayer(0); 32 | IConnectableLayer *OutputLayer = myNetwork->AddOutputLayer(0); 33 | 34 | InputLayer->GetOutputSlot(0).Connect(fullyConnected->GetInputSlot(0)); 35 | fullyConnected->GetOutputSlot(0).Connect(OutputLayer->GetInputSlot(0)); 36 | 37 | // Create ArmNN runtime 38 | IRuntime::CreationOptions options; // default options 39 | IRuntimePtr run = IRuntime::Create(options); 40 | 41 | //Set the tensors in the network. 42 | TensorInfo inputTensorInfo(TensorShape({1, 1}), DataType::Float32); 43 | InputLayer->GetOutputSlot(0).SetTensorInfo(inputTensorInfo); 44 | 45 | TensorInfo outputTensorInfo(TensorShape({1, 1}), DataType::Float32); 46 | fullyConnected->GetOutputSlot(0).SetTensorInfo(outputTensorInfo); 47 | 48 | // Optimise ArmNN network 49 | armnn::IOptimizedNetworkPtr optNet = Optimize(*myNetwork, {Compute::CpuRef}, run->GetDeviceSpec()); 50 | 51 | // Load graph into runtime 52 | run->LoadNetwork(networkIdentifier, std::move(optNet)); 53 | 54 | //Creates structures for inputs and outputs. 55 | std::vector inputData{number}; 56 | std::vector outputData(1); 57 | 58 | 59 | armnn::InputTensors inputTensors{{0, armnn::ConstTensor(run->GetInputTensorInfo(networkIdentifier, 0), 60 | inputData.data())}}; 61 | armnn::OutputTensors outputTensors{{0, armnn::Tensor(run->GetOutputTensorInfo(networkIdentifier, 0), 62 | outputData.data())}}; 63 | 64 | // Execute network 65 | run->EnqueueWorkload(networkIdentifier, inputTensors, outputTensors); 66 | 67 | std::cout << "Your number was " << outputData[0] << std::endl; 68 | return 0; 69 | 70 | } 71 | -------------------------------------------------------------------------------- /program/simplesample/.cm/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "backup_data_uid": "f34d649b8bbb846a", 3 | "pass_env_to_resolve": "yes", 4 | "compile_deps": { 5 | "compiler": { 6 | "local": "yes", 7 | "name": "C++ compiler", 8 | "sort": 10, 9 | "tags": "compiler,lang-cpp" 10 | }, 11 | "lib-armnn": { 12 | "comment": "Dynamic library added automatically to the Android-push list due to 'dynamic_library' customization", 13 | "local": "yes", 14 | "name": "ArmNN library", 15 | "sort": 20, 16 | "tags": "lib,armnn" 17 | } 18 | }, 19 | "compiler_env": "CK_CXX", 20 | "compiler_flags_as_env": "-fPIC $<>$ $<>$", 21 | "data_name": "simplesample", 22 | "extra_ld_vars": "-pie $<>$ $<>$ -L$<>$ -lboost_log -lboost_filesystem -lboost_atomic -lboost_date_time -lboost_regex -lboost_thread -lboost_chrono -lboost_system -L$<>$ -larmnn -pthread", 23 | "main_language": "cpp", 24 | "only_for_target_os_tags": [ 25 | "android", 26 | "linux", 27 | "windows" 28 | ], 29 | "process_in_tmp": "yes", 30 | "program": "yes", 31 | "run_deps": { 32 | "lib-boost": { 33 | "comment": "Although transitive dependency of ArmNN, still have to add it manually in order to push its dynamic libraries to Android", 34 | "local": "yes", 35 | "name": "Boost library", 36 | "skip_default": "yes", 37 | "add_dict": "yes", 38 | "sort": 30, 39 | "tags": "lib,boost,for-armnn", 40 | "version_from": [ 41 | 1, 42 | 64, 43 | 0 44 | ], 45 | "version_to": [ 46 | 1, 47 | 64, 48 | 0 49 | ], 50 | "only_for_target_os_tags": [ 51 | "android" 52 | ] 53 | } 54 | }, 55 | "run_cmds": { 56 | "default": { 57 | "run_time": { 58 | "run_cmd_main": "$#BIN_FILE#$", 59 | "run_input_files": [ 60 | "$<>$", 61 | "$<>$/lib/libboost_log.so.1.64.0", 62 | "$<>$/lib/libboost_atomic.so.1.64.0", 63 | "$<>$/lib/libboost_chrono.so.1.64.0", 64 | "$<>$/lib/libboost_date_time.so.1.64.0", 65 | "$<>$/lib/libboost_filesystem.so.1.64.0", 66 | "$<>$/lib/libboost_log.so.1.64.0", 67 | "$<>$/lib/libboost_log_setup.so.1.64.0", 68 | "$<>$/lib/libboost_prg_exec_monitor.so.1.64.0", 69 | "$<>$/lib/libboost_program_options.so.1.64.0", 70 | "$<>$/lib/libboost_regex.so.1.64.0", 71 | "$<>$/lib/libboost_system.so.1.64.0", 72 | "$<>$/lib/libboost_thread.so.1.64.0", 73 | "$<>$/lib/libboost_timer.so.1.64.0", 74 | "$<>$/lib/libboost_unit_test_framework.so.1.64.0" 75 | ] 76 | } 77 | } 78 | }, 79 | "source_files": [ 80 | "SimpleSample.cpp" 81 | ], 82 | "tags": [ 83 | "test", 84 | "armnn", 85 | "lang-cpp" 86 | ], 87 | "target_file": "SimpleSample" 88 | } 89 | -------------------------------------------------------------------------------- /soft/lib.armnn/customize.py: -------------------------------------------------------------------------------- 1 | # 2 | # Collective Knowledge (individual environment - setup) 3 | # 4 | # See CK LICENSE.txt for licensing details 5 | # See CK COPYRIGHT.txt for copyright details 6 | # 7 | # Developer: Leo Gordon @ dividiti 8 | # 9 | 10 | import os 11 | 12 | 13 | def setup(i): 14 | """ 15 | Input: { 16 | cfg - meta of this soft entry 17 | self_cfg - meta of module soft 18 | ck_kernel - import CK kernel module (to reuse functions) 19 | 20 | host_os_uoa - host OS UOA 21 | host_os_uid - host OS UID 22 | host_os_dict - host OS meta 23 | 24 | target_os_uoa - target OS UOA 25 | target_os_uid - target OS UID 26 | target_os_dict - target OS meta 27 | 28 | target_device_id - target device ID (if via ADB) 29 | 30 | tags - list of tags used to search this entry 31 | 32 | env - updated environment vars from meta 33 | customize - updated customize vars from meta 34 | 35 | deps - resolved dependencies for this soft 36 | 37 | interactive - if 'yes', can ask questions, otherwise quiet 38 | } 39 | 40 | Output: { 41 | return - return code = 0, if successful 42 | > 0, if error 43 | (error) - error text if return > 0 44 | 45 | bat - prepared string for bat file 46 | } 47 | 48 | """ 49 | 50 | 51 | # Get variables 52 | ck = i['ck_kernel'] 53 | cus = i.get('customize',{}) 54 | fp = cus.get('full_path','') 55 | 56 | path_lib = os.path.dirname( fp ) 57 | install_root = os.path.dirname( path_lib ) 58 | path_include = os.path.join( install_root, 'include' ) 59 | 60 | env = i['env'] 61 | hosd = i['host_os_dict'] 62 | env_prefix = cus['env_prefix'] 63 | 64 | # We need to pass this path to the users of ArmNN library 65 | # 66 | boost_include = i.get('deps',{}).get('lib-boost',{}).get('dict',{}).get('customize',{}).get('path_include','') 67 | 68 | # This env-setting method is the most introspective (the paths generated may be post-processed), 69 | # but rather restrictive - only certain variable names are taken into account: 70 | # (higher level) 71 | # 72 | cus['path_lib'] = path_lib 73 | cus['path_include'] = path_include 74 | cus['path_includes'] = [boost_include, path_include] 75 | 76 | # Any variable that ends up in "env" will become a part of the env-setting script: 77 | # (medium level) 78 | # 79 | env[env_prefix] = install_root 80 | 81 | # A monolythic OS-dependent script is generated here: 82 | # (lower level) 83 | # 84 | r = ck.access({'action': 'lib_path_export_script', 85 | 'module_uoa': 'os', 86 | 'host_os_dict': hosd, 87 | 'lib_path': path_lib }) 88 | if r['return']>0: return r 89 | shell_setup_script_contents = r['script'] 90 | 91 | return {'return': 0, 'bat': shell_setup_script_contents} 92 | -------------------------------------------------------------------------------- /program/mnist-armnn-tf/mnist_loader.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2017 Arm Ltd. All rights reserved. 3 | // See LICENSE file in the project root for full license information. 4 | // 5 | 6 | #pragma once 7 | 8 | constexpr int g_kMnistImageByteSize = 28 * 28; 9 | 10 | // Helper struct for loading MNIST data 11 | struct MnistImage 12 | { 13 | unsigned int label; 14 | float image[g_kMnistImageByteSize]; 15 | }; 16 | 17 | // MNIST data files are big endian; we will need to swap them 18 | void EndianSwap(unsigned int &x) 19 | { 20 | x = (x >> 24) | ((x << 8) & 0x00FF0000) | ((x >> 8) & 0x0000FF00) | (x << 24); 21 | } 22 | 23 | // Load a single MNIST image from the raw data files - none of this is Arm NN-specific 24 | std::unique_ptr loadMnistImage(std::string dataDir, int image) 25 | { 26 | std::vector I(g_kMnistImageByteSize); 27 | unsigned int label = 0; 28 | 29 | std::string imagePath = dataDir + std::string("t10k-images-idx3-ubyte"); 30 | std::string labelPath = dataDir + std::string("t10k-labels-idx1-ubyte"); 31 | 32 | std::ifstream imageStream(imagePath, std::ios::binary); 33 | std::ifstream labelStream(labelPath, std::ios::binary); 34 | 35 | if (!imageStream.is_open()) 36 | { 37 | std::cerr << "Failed to load " << imagePath << std::endl; 38 | return nullptr; 39 | } 40 | if (!labelStream.is_open()) 41 | { 42 | std::cerr << "Failed to load " << labelPath << std::endl; 43 | return nullptr; 44 | } 45 | 46 | unsigned int magic, num, row, col; 47 | 48 | // check the files have the correct header 49 | imageStream.read(reinterpret_cast(&magic), sizeof(magic)); 50 | if (magic != 0x03080000) 51 | { 52 | std::cerr << "Failed to read " << imagePath << std::endl; 53 | return nullptr; 54 | } 55 | labelStream.read(reinterpret_cast(&magic), sizeof(magic)); 56 | if (magic != 0x01080000) 57 | { 58 | std::cerr << "Failed to read " << labelPath << std::endl; 59 | return nullptr; 60 | } 61 | 62 | // Endian swap image and label file - All the integers in the files are stored in MSB first(high endian) format, 63 | // hence need to flip the bytes of the header if using it on Intel processors or low-endian machines 64 | labelStream.read(reinterpret_cast(&num), sizeof(num)); 65 | imageStream.read(reinterpret_cast(&num), sizeof(num)); 66 | EndianSwap(num); 67 | imageStream.read(reinterpret_cast(&row), sizeof(row)); 68 | EndianSwap(row); 69 | imageStream.read(reinterpret_cast(&col), sizeof(col)); 70 | EndianSwap(col); 71 | 72 | // read image and label into memory 73 | imageStream.seekg(image * g_kMnistImageByteSize, std::ios_base::cur); 74 | imageStream.read(reinterpret_cast(&I[0]), g_kMnistImageByteSize); 75 | labelStream.seekg(image, std::ios_base::cur); 76 | labelStream.read(reinterpret_cast(&label), 1); 77 | 78 | if (!imageStream.good()) 79 | { 80 | std::cerr << "Failed to read " << imagePath << std::endl; 81 | return nullptr; 82 | } 83 | if (!labelStream.good()) 84 | { 85 | std::cerr << "Failed to read " << labelPath << std::endl; 86 | return nullptr; 87 | } 88 | 89 | // store image and label in MnistImage 90 | std::unique_ptr ret(new MnistImage); 91 | ret->label = label; 92 | 93 | for (unsigned int i = 0; i < col * row; ++i) 94 | { 95 | ret->image[i] = static_cast(I[i]); 96 | } 97 | 98 | return ret; 99 | } 100 | 101 | -------------------------------------------------------------------------------- /package/lib-armcl-viascons/.cm/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "customize": { 3 | "extra_dir": "", 4 | "git_src_dir": "src", 5 | "install_env": { 6 | "PACKAGE_BUILD_TYPE": "skip", 7 | "PACKAGE_GIT": "YES", 8 | "PACKAGE_SKIP_CLEAN_OBJ": "YES", 9 | "PACKAGE_SKIP_CLEAN_SRC_DIR": "YES", 10 | "PACKAGE_SKIP_LINUX_MAKE": "YES", 11 | "PACKAGE_SUB_DIR": "src", 12 | "PACKAGE_URL": "https://github.com/ARM-software/ComputeLibrary", 13 | "PACKAGE_VERSION": "release", 14 | "USE_NEON": "NO", 15 | "USE_OPENCL": "NO" 16 | } 17 | }, 18 | "deps": { 19 | "compiler": { 20 | "local": "yes", 21 | "name": "C++ compiler", 22 | "sort": 10, 23 | "tags": "compiler,lang-cpp" 24 | }, 25 | "scons": { 26 | "local": "yes", 27 | "force_target_as_host": "yes", 28 | "name": "SCons tool", 29 | "sort": 20, 30 | "tags": "tool,scons" 31 | }, 32 | "standalone-toolchain": { 33 | "enable_if_env": [ 34 | { "CK_TARGET_OS_ID": ["android"] } 35 | ], 36 | "local": "yes", 37 | "name": "NDK standalone toolchain", 38 | "sort": 30, 39 | "tags": "ndk,standalone-toolchain" 40 | } 41 | }, 42 | "end_full_path_universal": [ 43 | "install$#sep#$lib$#sep#$libarm_compute$#file_ext_dll#$", 44 | "install$#sep#$lib$#sep#$libarm_compute-static$#file_ext_lib#$" 45 | ], 46 | "need_cpu_info": "yes", 47 | "only_for_host_os_tags": [ 48 | "linux" 49 | ], 50 | "only_for_target_os_tags": [ 51 | "linux", 52 | "android" 53 | ], 54 | "process_script": "install", 55 | "soft_uoa": "lib.armcl", 56 | "suggested_path": "lib-armcl", 57 | "tags": [ 58 | "lib", 59 | "armcl", 60 | "viascons" 61 | ], 62 | "variations": { 63 | "release": { 64 | }, 65 | "rel.18.08": { 66 | "extra_env": { 67 | "PACKAGE_GIT_CHECKOUT": "v18.08", 68 | "PACKAGE_VERSION": "18.08" 69 | } 70 | }, 71 | "rel.18.11": { 72 | "extra_env": { 73 | "PACKAGE_GIT_CHECKOUT": "v18.11", 74 | "PACKAGE_VERSION": "18.11" 75 | } 76 | }, 77 | "rel.19.02": { 78 | "extra_env": { 79 | "PACKAGE_GIT_CHECKOUT": "v19.02", 80 | "PACKAGE_VERSION": "19.02" 81 | } 82 | }, 83 | "rel.19.05": { 84 | "extra_env": { 85 | "PACKAGE_GIT_CHECKOUT": "v19.05", 86 | "PACKAGE_VERSION": "19.05" 87 | } 88 | }, 89 | "rel.19.08": { 90 | "extra_env": { 91 | "PACKAGE_GIT_CHECKOUT": "v19.08", 92 | "PACKAGE_VERSION": "19.08" 93 | } 94 | }, 95 | "rel.20.05": { 96 | "extra_env": { 97 | "PACKAGE_GIT_CHECKOUT": "v20.05", 98 | "PACKAGE_VERSION": "20.05" 99 | } 100 | }, 101 | "rel.20.08": { 102 | "extra_env": { 103 | "PACKAGE_GIT_CHECKOUT": "v20.08", 104 | "PACKAGE_VERSION": "20.08" 105 | } 106 | }, 107 | "dev": { 108 | "extra_env": { 109 | "PACKAGE_URL": "https://review.mlplatform.org/ml/ComputeLibrary", 110 | "PACKAGE_VERSION": "dev" 111 | } 112 | }, 113 | "neon": { 114 | "extra_env": { 115 | "USE_NEON": "YES" 116 | } 117 | }, 118 | "opencl": { 119 | "extra_env": { 120 | "USE_OPENCL": "YES" 121 | } 122 | } 123 | }, 124 | "use_scripts_from_another_entry": { 125 | "data_uoa": "download-and-install-package", 126 | "module_uoa": "script" 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /package/lib-armnn/patch.variations/rel.20.05_hardswish.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/armnnTfLiteParser/TfLiteParser.cpp b/src/armnnTfLiteParser/TfLiteParser.cpp 2 | index 1ae2de0a..47b0315a 100644 3 | --- a/src/armnnTfLiteParser/TfLiteParser.cpp 4 | +++ b/src/armnnTfLiteParser/TfLiteParser.cpp 5 | @@ -502,6 +502,7 @@ TfLiteParser::TfLiteParser(const Optional& o 6 | m_ParserFunctions[tflite::BuiltinOperator_DEQUANTIZE] = &TfLiteParser::ParseDequantize; 7 | m_ParserFunctions[tflite::BuiltinOperator_EXP] = &TfLiteParser::ParseExp; 8 | m_ParserFunctions[tflite::BuiltinOperator_FULLY_CONNECTED] = &TfLiteParser::ParseFullyConnected; 9 | + m_ParserFunctions[tflite::BuiltinOperator_HARD_SWISH] = &TfLiteParser::ParseHardSwish; 10 | m_ParserFunctions[tflite::BuiltinOperator_LOGISTIC] = &TfLiteParser::ParseLogistic; 11 | m_ParserFunctions[tflite::BuiltinOperator_L2_NORMALIZATION] = &TfLiteParser::ParseL2Normalization; 12 | m_ParserFunctions[tflite::BuiltinOperator_MAX_POOL_2D] = &TfLiteParser::ParseMaxPool2D; 13 | @@ -1860,6 +1861,12 @@ void TfLiteParser::ParseTanH(size_t subgraphIndex, size_t operatorIndex) 14 | ParseActivation(subgraphIndex,operatorIndex,ActivationFunction::TanH); 15 | } 16 | 17 | +void TfLiteParser::ParseHardSwish(size_t subgraphIndex, size_t operatorIndex) 18 | +{ 19 | + ParseActivation(subgraphIndex, operatorIndex, ActivationFunction::HardSwish); 20 | +} 21 | + 22 | + 23 | 24 | void TfLiteParser::ParseActivation(size_t subgraphIndex, size_t operatorIndex, ActivationFunction activationType) 25 | { 26 | @@ -1903,6 +1910,12 @@ void TfLiteParser::ParseActivation(size_t subgraphIndex, size_t operatorIndex, A 27 | activationDesc.m_B = 1.0f; 28 | break; 29 | } 30 | + case ActivationFunction::HardSwish: 31 | + { 32 | + layerName += str(boost::format("HARDSWISH:%1%:%2%") % subgraphIndex % operatorIndex); 33 | + break; 34 | + } 35 | + 36 | default: 37 | { 38 | throw ParseException( 39 | diff --git a/src/armnnTfLiteParser/TfLiteParser.hpp b/src/armnnTfLiteParser/TfLiteParser.hpp 40 | index c72f7ad7..ab7722ab 100644 41 | --- a/src/armnnTfLiteParser/TfLiteParser.hpp 42 | +++ b/src/armnnTfLiteParser/TfLiteParser.hpp 43 | @@ -104,6 +104,7 @@ private: 44 | void ParseDetectionPostProcess(size_t subgraphIndex, size_t operatorIndex); 45 | void ParseExp(size_t subgraphIndex, size_t operatorIndex); 46 | void ParseFullyConnected(size_t subgraphIndex, size_t operatorIndex); 47 | + void ParseHardSwish(size_t subgraphIndex, size_t operatorIndex); 48 | void ParseLogistic(size_t subgraphIndex, size_t operatorIndex); 49 | void ParseL2Normalization(size_t subgraphIndex, size_t operatorIndex); 50 | void ParseMaxPool2D(size_t subgraphIndex, size_t operatorIndex); 51 | diff --git a/src/armnnTfLiteParser/test/Activations.cpp b/src/armnnTfLiteParser/test/Activations.cpp 52 | index e8153a28..e57477e6 100644 53 | --- a/src/armnnTfLiteParser/test/Activations.cpp 54 | +++ b/src/armnnTfLiteParser/test/Activations.cpp 55 | @@ -105,4 +105,16 @@ BOOST_FIXTURE_TEST_CASE(ParseTanH, TanHFixture) 56 | { -0.1f, -0.2f, -0.3f, -0.4f, 0.1f, 0.2f, 0.3f }, 57 | { -0.09966799f, -0.19737528f, -0.29131261f, -0.379949f, 0.09966799f, 0.19737528f, 0.29131261f }); 58 | } 59 | + 60 | +struct HardSwishFixture : ActivationFixture 61 | +{ 62 | + HardSwishFixture() : ActivationFixture("HARD_SWISH", "FLOAT32") {} 63 | +}; 64 | + 65 | +BOOST_FIXTURE_TEST_CASE(ParseHardSwish, HardSwishFixture) 66 | +{ 67 | + RunTest<2, armnn::DataType::Float32>(0, 68 | + { -4.0f, -3.0f, -2.9f, 1.2f, 2.2f, 3.0f, 4.0f }, 69 | + { -0.0f, -0.0f, -0.04833334f, 0.84f, 1.90666667f, 3.0f, 4.0f }); 70 | +} 71 | BOOST_AUTO_TEST_SUITE_END() 72 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # After changing this file, check it on: 2 | # http://lint.travis-ci.org/ 3 | 4 | os: linux 5 | dist: xenial 6 | sudo: false 7 | language: python 8 | 9 | python: 10 | - 3.5 11 | - 3.6 12 | 13 | addons: 14 | apt: 15 | packages: 16 | - g++-7 17 | - python-pip 18 | sources: 19 | - ubuntu-toolchain-r-test 20 | 21 | env: 22 | matrix: 23 | - TRAVIS_CK_CXX_COMPILER=gcc ARMNN_SUPPORTED_FRONTENDS=tf,tflite,onnx 24 | 25 | matrix: 26 | include: 27 | - os: osx 28 | osx_image: xcode10.2 29 | language: generic 30 | python: 2.7 31 | env: WANTED_PYTHON_VERSION=2.7 TRAVIS_CK_CXX_COMPILER=llvm ARMNN_SUPPORTED_FRONTENDS=tf,onnx 32 | - os: osx 33 | osx_image: xcode10.2 34 | language: generic 35 | python: 3.6 36 | env: WANTED_PYTHON_VERSION=3.6 TRAVIS_CK_CXX_COMPILER=llvm ARMNN_SUPPORTED_FRONTENDS=tf,onnx 37 | 38 | before_install: 39 | - | 40 | if [ $TRAVIS_OS_NAME == "osx" ]; then 41 | brew update # this swaps python versions and makes 3 the default one 42 | 43 | if [ "$WANTED_PYTHON_VERSION" == "2.7" ]; then 44 | brew reinstall python\@2 || brew link --overwrite python\@2 # install and link python2 and pip2 to /usr/local/bin 45 | export PATH=/usr/local/opt/python\@2/bin:$PATH 46 | export PYTHON_EXE=python 47 | else 48 | brew unlink python 49 | brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb --ignore-dependencies 50 | brew switch python 3.6.5_1 51 | export PATH=/usr/local/opt/python/bin:$PATH 52 | export PYTHON_EXE=python3 53 | fi 54 | 55 | export CK_PLATFORM_NAME="generic-macos " # used later by CK 56 | else 57 | export WANTED_PYTHON_VERSION=$TRAVIS_PYTHON_VERSION # since Python is supported in Linux, get it from Travis 58 | export PYTHON_EXE=python 59 | export CK_PLATFORM_NAME="generic-linux " # used later by CK (note the trailing space to make the choice unique) 60 | fi 61 | 62 | install: 63 | - CWD=`pwd` 64 | - THIS_REPO_NAME=`basename $CWD` 65 | - echo "TRAVIS_OS_NAME=${TRAVIS_OS_NAME}, WANTED_PYTHON_VERSION=${WANTED_PYTHON_VERSION}" 66 | - echo "CWD=${CWD}, THIS_REPO_NAME=${THIS_REPO_NAME}, PATH=${PATH}" 67 | - which "${PYTHON_EXE}" 68 | - ${PYTHON_EXE} --version 69 | - rm -f `which pip` # the file is removable, but not writeable 70 | - ${PYTHON_EXE} -m pip install --ignore-installed --verbose pip setuptools # make sure pip is also up to date no matter what 71 | - ${PYTHON_EXE} -m pip install -r requirements.txt # ck kernel itself and some essential components 72 | - ck pull repo:${THIS_REPO_NAME} # ...also trigger pulling dependent repositories 73 | - echo "$CK_PLATFORM_NAME" | ck detect platform.os --update_platform_init # set the platform to generic-linux (1) or generic-macos (2) 74 | - ck detect soft:compiler.python --full_path=`which ${PYTHON_EXE}` # pick the one Travis has set for us in the PATH 75 | - echo | ck detect soft:tool.cmake --first_match # avoid manual selection 76 | - echo | ck detect soft:compiler.${TRAVIS_CK_CXX_COMPILER} --first_match # avoid manual selection 77 | - ck install package --tags=lib,boost,v1.64.0,for-armnn > boost_install.log # the log is too long for Travis to survive 78 | - ck install package:lib-protobuf-3.5.1-host # avoid manual selection 79 | - ck install package --tags=lib,armnn,rel.19.08,${ARMNN_SUPPORTED_FRONTENDS} 80 | 81 | script: 82 | - ck show env # show everything that has been detected or installed 83 | - ck compile program:simplesample 84 | - echo 14 | ck run program:simplesample # this program doesn't use any frontends 85 | - ck compile program:mnist-armnn-tf 86 | - ck run program:mnist-armnn-tf # this program uses the TF frontend 87 | 88 | after_failure: 89 | - tail -n 500 boost_install.log 90 | 91 | -------------------------------------------------------------------------------- /program/mnist-armnn-tf/mnist_tf.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2017 Arm Ltd. All rights reserved. 3 | // See LICENSE file in the project root for full license information. 4 | // 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include "armnn/ArmNN.hpp" 16 | #include "armnn/Exceptions.hpp" 17 | #include "armnn/Tensor.hpp" 18 | #include "armnn/INetwork.hpp" 19 | #include "armnnTfParser/ITfParser.hpp" 20 | 21 | #include "mnist_loader.hpp" 22 | 23 | /// Load an optional boolean value from the environment. 24 | inline bool getenv_b(const char *name) { 25 | std::string value = getenv(name); 26 | 27 | return (value == "YES" || value == "yes" || value == "ON" || value == "on" || value == "1"); 28 | } 29 | 30 | 31 | // Helper function to make input tensors 32 | armnn::InputTensors MakeInputTensors(const std::pair& input, 34 | const void* inputTensorData) 35 | { 36 | return { { input.first, armnn::ConstTensor(input.second, inputTensorData) } }; 37 | } 38 | 39 | // Helper function to make output tensors 40 | armnn::OutputTensors MakeOutputTensors(const std::pair& output, 42 | void* outputTensorData) 43 | { 44 | return { { output.first, armnn::Tensor(output.second, outputTensorData) } }; 45 | } 46 | 47 | int main(int argc, char** argv) 48 | { 49 | bool use_neon = getenv_b("USE_NEON"); 50 | bool use_opencl = getenv_b("USE_OPENCL"); 51 | 52 | if (argc != 4) { 53 | std::cerr << "Usage: " << argv[0] 54 | << " model image-directory file-number" << std::endl; 55 | return 1; 56 | } 57 | 58 | std::string model = argv[1]; 59 | std::string dataDir = argv[2]; 60 | std::string fileNumber = argv[3]; 61 | 62 | struct stat info; 63 | if (stat(model.c_str(), &info) != 0) { 64 | printf("%s is not a file\n", model.c_str()); 65 | return 1; 66 | } 67 | 68 | if (dataDir.back() != '/') dataDir.append("/"); 69 | stat(dataDir.c_str(), &info); 70 | if(!(info.st_mode & S_IFDIR)) { 71 | printf("%s is not a directory\n", dataDir.c_str()); 72 | return 1; 73 | } 74 | 75 | int testImageIndex = std::stoi(fileNumber.c_str()); 76 | 77 | // Load a test image and its correct label 78 | std::unique_ptr input = loadMnistImage(dataDir.c_str(), testImageIndex); 79 | if (input == nullptr) 80 | return 1; 81 | 82 | // Import the TensorFlow model. Note: use CreateNetworkFromBinaryFile for .pb files. 83 | armnnTfParser::ITfParserPtr parser = armnnTfParser::ITfParser::Create(); 84 | armnn::INetworkPtr network = parser->CreateNetworkFromTextFile(model.c_str(), 85 | { {"Placeholder", {1, 784, 1, 1}} }, 86 | { "Softmax" }); 87 | 88 | // Find the binding points for the input and output nodes 89 | armnnTfParser::BindingPointInfo inputBindingInfo = parser->GetNetworkInputBindingInfo("Placeholder"); 90 | armnnTfParser::BindingPointInfo outputBindingInfo = parser->GetNetworkOutputBindingInfo("Softmax"); 91 | 92 | // Optimize the network for a specific runtime compute device, e.g. CpuAcc, GpuAcc 93 | std::vector optOptions = {armnn::Compute::CpuRef}; 94 | if( use_neon && use_opencl) { 95 | optOptions = {armnn::Compute::CpuAcc, armnn::Compute::GpuAcc}; 96 | } else if( use_neon ) { 97 | optOptions = {armnn::Compute::CpuAcc}; 98 | } else if( use_opencl ) { 99 | optOptions = {armnn::Compute::GpuAcc}; 100 | } 101 | armnn::IRuntime::CreationOptions options; 102 | armnn::IRuntimePtr runtime = armnn::IRuntime::Create(options); 103 | armnn::IOptimizedNetworkPtr optNet = armnn::Optimize(*network, optOptions, runtime->GetDeviceSpec()); 104 | 105 | // Load the optimized network onto the runtime device 106 | armnn::NetworkId networkIdentifier; 107 | runtime->LoadNetwork(networkIdentifier, std::move(optNet)); 108 | 109 | // Run a single inference on the test image 110 | std::array output; 111 | armnn::Status ret = runtime->EnqueueWorkload(networkIdentifier, 112 | MakeInputTensors(inputBindingInfo, &input->image[0]), 113 | MakeOutputTensors(outputBindingInfo, &output[0])); 114 | 115 | // Convert 1-hot output to an integer label and print 116 | int label = std::distance(output.begin(), std::max_element(output.begin(), output.end())); 117 | std::cout << "Predicted: " << label << std::endl; 118 | std::cout << " Actual: " << input->label << std::endl; 119 | return 0; 120 | } 121 | -------------------------------------------------------------------------------- /package/lib-armnn/scripts.android/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # See CK LICENSE.txt for licensing details. 5 | # See CK COPYRIGHT.txt for copyright details. 6 | # 7 | # Developer(s): 8 | # - Leo Gordon, 2019 9 | # - Anton Lokhmotov, 2019 10 | # 11 | 12 | ################ Global: ############################################# 13 | 14 | ARMNN_SOURCE_DIR=$INSTALL_DIR/$PACKAGE_SUB_DIR 15 | ARMNN_BUILD_DIR=$INSTALL_DIR/obj 16 | export ARMNN_TARGET_DIR=$INSTALL_DIR/install 17 | 18 | TF_PB_DIR=$INSTALL_DIR/generated_tf_pb_files 19 | ONNX_SRC_DIR=$INSTALL_DIR/onnx 20 | 21 | function exit_if_error() { 22 | if [ "${?}" != "0" ]; then exit 1; fi 23 | } 24 | 25 | echo "" 26 | echo "Building ArmNN '${PACKAGE_VERSION}' in '${INSTALL_DIR}'." 27 | echo "Frontends: USE_TF='${USE_TF}'; USE_TFLITE='${USE_TFLITE}'; USE_ONNX='${USE_ONNX}'." 28 | echo "Backends: USE_NEON='${USE_NEON}'; USE_OPENCL='${USE_OPENCL}'" 29 | echo "" 30 | 31 | ################ Frontend: ########################################### 32 | 33 | if [ "$USE_TFLITE" == "YES" ] || [ "$USE_TFLITE" == "yes" ] || [ "$USE_TFLITE" == "ON" ] || [ "$USE_TFLITE" == "on" ] || [ "$USE_TFLITE" == "1" ] 34 | then 35 | CMAKE_FOR_TFLITE=" -DBUILD_TF_LITE_PARSER=1 -DTF_LITE_GENERATED_PATH=${CK_ENV_LIB_TF_SRC_SRC}/tensorflow/lite/schema -DFLATBUFFERS_ROOT=${CK_ENV_LIB_FLATBUFFERS} -DFLATBUFFERS_LIBRARY=${CK_ENV_LIB_FLATBUFFERS_LIB}/libflatbuffers.a " 36 | else 37 | CMAKE_FOR_TFLITE="" 38 | fi 39 | 40 | if [ -n "$CMAKE_FOR_TFLITE" ] || [ "$USE_TF" == "YES" ] || [ "$USE_TF" == "yes" ] || [ "$USE_TF" == "ON" ] || [ "$USE_TF" == "on" ] || [ "$USE_TF" == "1" ] 41 | then 42 | echo "" 43 | echo "Generating Protobuf files from Tensorflow ..." 44 | echo "" 45 | 46 | rm -rf "${TF_PB_DIR}" 47 | mkdir ${TF_PB_DIR} 48 | cd ${CK_ENV_LIB_TF_SRC_SRC} 49 | ${ARMNN_SOURCE_DIR}/scripts/generate_tensorflow_protobuf.sh ${TF_PB_DIR} ${CK_ENV_LIB_PROTOBUF_HOST} 50 | exit_if_error 51 | 52 | CMAKE_FOR_TF=" -DBUILD_TF_PARSER=1 -DTF_GENERATED_SOURCES=${TF_PB_DIR} " 53 | else 54 | CMAKE_FOR_TF="" 55 | fi 56 | 57 | if [ "$USE_ONNX" == "YES" ] || [ "$USE_ONNX" == "yes" ] || [ "$USE_ONNX" == "ON" ] || [ "$USE_ONNX" == "on" ] || [ "$USE_ONNX" == "1" ] 58 | then 59 | echo "" 60 | echo "Generating Protobuf files from ONNX ..." 61 | echo "" 62 | 63 | rm -rf "${ONNX_SRC_DIR}" 64 | export ONNX_ML=1 #To clone ONNX with its ML extension 65 | git clone ${ONNX_BRANCH} --recursive ${ONNX_SRC_URL} ${ONNX_SRC_DIR} 66 | unset ONNX_ML 67 | cd ${ONNX_SRC_DIR} 68 | ${CK_ENV_LIB_PROTOBUF_HOST_BIN}/protoc onnx/onnx.proto --proto_path=. --proto_path=${CK_ENV_LIB_PROTOBUF_HOST_INCLUDE} --cpp_out ${ONNX_SRC_DIR} 69 | exit_if_error 70 | 71 | CMAKE_FOR_ONNX=" -DBUILD_ONNX_PARSER=1 -DONNX_GENERATED_SOURCES=${ONNX_SRC_DIR} " 72 | else 73 | CMAKE_FOR_ONNX="" 74 | fi 75 | 76 | ################ Backend: ############################################ 77 | 78 | if [ "$USE_NEON" == "YES" ] || [ "$USE_NEON" == "yes" ] || [ "$USE_NEON" == "ON" ] || [ "$USE_NEON" == "on" ] || [ "$USE_NEON" == "1" ] 79 | then 80 | CMAKE_FOR_NEON=" -DARMCOMPUTENEON=1 " 81 | else 82 | CMAKE_FOR_NEON="" 83 | fi 84 | 85 | if [ "$USE_OPENCL" == "YES" ] || [ "$USE_OPENCL" == "yes" ] || [ "$USE_OPENCL" == "ON" ] || [ "$USE_OPENCL" == "on" ] || [ "$USE_OPENCL" == "1" ] 86 | then 87 | CMAKE_FOR_OPENCL=" -DARMCOMPUTECL=1 " 88 | else 89 | CMAKE_FOR_OPENCL="" 90 | fi 91 | 92 | ################ Default for Android is "NO": ####################### 93 | 94 | if [ "$CK_ARMNN_BUILD_TESTS" == "" ] 95 | then 96 | CK_ARMNN_BUILD_TESTS="NO" 97 | fi 98 | 99 | ############################################################ 100 | echo "" 101 | echo "Running cmake for ArmNN ..." 102 | echo "" 103 | 104 | rm -rf "${ARMNN_BUILD_DIR}" 105 | mkdir ${ARMNN_BUILD_DIR} 106 | cd ${ARMNN_BUILD_DIR} 107 | 108 | 109 | # Why we need DBOOST_LOG_DYN_LINK: 110 | # https://stackoverflow.com/questions/23137637/linker-error-while-linking-boost-log-tutorial-undefined-references 111 | 112 | ${CK_ENV_TOOL_CMAKE_BIN}/cmake ${ARMNN_SOURCE_DIR} \ 113 | -DCMAKE_CROSSCOMPILING=YES \ 114 | -DCMAKE_SYSTEM_NAME=Android \ 115 | -DCMAKE_ANDROID_API=${CK_ANDROID_API_LEVEL} \ 116 | -DCMAKE_ANDROID_ARCH_ABI=${CK_ANDROID_ABI} \ 117 | -DCMAKE_ANDROID_STANDALONE_TOOLCHAIN=${CK_ENV_STANDALONE_TOOLCHAIN_ROOT} \ 118 | -DCMAKE_CXX_FLAGS="-fPIE -fPIC -DBOOST_LOG_DYN_LINK=1" \ 119 | -DCMAKE_EXE_LINKER_FLAGS="-pie -llog" \ 120 | -DCMAKE_EXE_LINKER_FLAGS="${CK_LINKER_FLAGS_ANDROID_TYPICAL} ${CK_COMPILER_FLAG_PTHREAD_LIB}" \ 121 | -DCMAKE_INSTALL_PREFIX:PATH="${ARMNN_TARGET_DIR}" \ 122 | -DARMCOMPUTE_ROOT=${CK_ENV_LIB_ARMCL_SRC} \ 123 | -DARMCOMPUTE_BUILD_DIR=${CK_ENV_LIB_ARMCL_SRC}/build \ 124 | -DBOOST_ROOT=${CK_ENV_LIB_BOOST} \ 125 | -DBoost_NO_BOOST_CMAKE=NO \ 126 | -DPROTOBUF_ROOT=${CK_ENV_LIB_PROTOBUF} \ 127 | ${CMAKE_FOR_TF} ${CMAKE_FOR_TFLITE} ${CMAKE_FOR_ONNX} \ 128 | ${CMAKE_FOR_NEON} ${CMAKE_FOR_OPENCL} \ 129 | -DBUILD_UNIT_TESTS=${CK_ARMNN_BUILD_TESTS} \ 130 | -DCMAKE_VERBOSE_MAKEFILE=NO # very useful to flip over when debugging! 131 | 132 | -------------------------------------------------------------------------------- /package/lib-armnn/scripts.linux/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # See CK LICENSE.txt for licensing details. 5 | # See CK COPYRIGHT.txt for copyright details. 6 | # 7 | # Developer(s): 8 | # - Leo Gordon, 2019 9 | # - Anton Lokhmotov, 2019 10 | # 11 | 12 | ################ Global: ############################################# 13 | 14 | ARMNN_SOURCE_DIR=$INSTALL_DIR/$PACKAGE_SUB_DIR 15 | ARMNN_BUILD_DIR=$INSTALL_DIR/obj 16 | ARMNN_TARGET_DIR=$INSTALL_DIR/install 17 | 18 | TF_PB_DIR=$INSTALL_DIR/generated_tf_pb_files 19 | ONNX_SRC_DIR=$INSTALL_DIR/onnx 20 | 21 | function exit_if_error() { 22 | if [ "${?}" != "0" ]; then exit 1; fi 23 | } 24 | 25 | echo "" 26 | echo "Building ArmNN '${PACKAGE_VERSION}' in '${INSTALL_DIR}'." 27 | echo "Frontends: USE_TF='${USE_TF}'; USE_TFLITE='${USE_TFLITE}'; USE_ONNX='${USE_ONNX}'." 28 | echo "Backends: USE_NEON='${USE_NEON}'; USE_OPENCL='${USE_OPENCL}'." 29 | echo "Extra flags: '${EXTRA_FLAGS}'" 30 | echo "" 31 | 32 | ################ Frontend: ########################################### 33 | 34 | if [ "$USE_TFLITE" == "YES" ] || [ "$USE_TFLITE" == "yes" ] || [ "$USE_TFLITE" == "ON" ] || [ "$USE_TFLITE" == "on" ] || [ "$USE_TFLITE" == "1" ] 35 | then 36 | CMAKE_FOR_TFLITE=" -DBUILD_TF_LITE_PARSER=1 -DTF_LITE_GENERATED_PATH=${CK_ENV_LIB_TF_SRC_SRC}/tensorflow/lite/schema -DFLATBUFFERS_ROOT=${CK_ENV_LIB_FLATBUFFERS} -DFLATBUFFERS_LIBRARY=${CK_ENV_LIB_FLATBUFFERS_LIB}/libflatbuffers.a " 37 | else 38 | CMAKE_FOR_TFLITE="" 39 | fi 40 | 41 | if [ -n "$CMAKE_FOR_TFLITE" ] || [ "$USE_TF" == "YES" ] || [ "$USE_TF" == "yes" ] || [ "$USE_TF" == "ON" ] || [ "$USE_TF" == "on" ] || [ "$USE_TF" == "1" ] 42 | then 43 | echo "" 44 | echo "Generating Protobuf files from Tensorflow ..." 45 | echo "" 46 | 47 | rm -rf "${TF_PB_DIR}" 48 | mkdir ${TF_PB_DIR} 49 | cd ${CK_ENV_LIB_TF_SRC_SRC} 50 | ${ARMNN_SOURCE_DIR}/scripts/generate_tensorflow_protobuf.sh ${TF_PB_DIR} ${CK_ENV_LIB_PROTOBUF_HOST} 51 | exit_if_error 52 | 53 | CMAKE_FOR_TF=" -DBUILD_TF_PARSER=1 -DTF_GENERATED_SOURCES=${TF_PB_DIR} " 54 | else 55 | CMAKE_FOR_TF="" 56 | fi 57 | 58 | if [ "$USE_ONNX" == "YES" ] || [ "$USE_ONNX" == "yes" ] || [ "$USE_ONNX" == "ON" ] || [ "$USE_ONNX" == "on" ] || [ "$USE_ONNX" == "1" ] 59 | then 60 | echo "" 61 | echo "Generating Protobuf files from ONNX ..." 62 | echo "" 63 | 64 | rm -rf "${ONNX_SRC_DIR}" 65 | export ONNX_ML=1 #To clone ONNX with its ML extension 66 | git clone ${ONNX_BRANCH} --recursive ${ONNX_SRC_URL} ${ONNX_SRC_DIR} 67 | unset ONNX_ML 68 | cd ${ONNX_SRC_DIR} 69 | ${CK_ENV_LIB_PROTOBUF_HOST_BIN}/protoc onnx/onnx.proto --proto_path=. --proto_path=${CK_ENV_LIB_PROTOBUF_HOST_INCLUDE} --cpp_out ${ONNX_SRC_DIR} 70 | exit_if_error 71 | 72 | CMAKE_FOR_ONNX=" -DBUILD_ONNX_PARSER=1 -DONNX_GENERATED_SOURCES=${ONNX_SRC_DIR} " 73 | else 74 | CMAKE_FOR_ONNX="" 75 | fi 76 | 77 | ################ Backend: ############################################ 78 | 79 | if [ "$USE_NEON" == "YES" ] || [ "$USE_NEON" == "yes" ] || [ "$USE_NEON" == "ON" ] || [ "$USE_NEON" == "on" ] || [ "$USE_NEON" == "1" ] 80 | then 81 | CMAKE_FOR_NEON=" -DARMCOMPUTENEON=1 " 82 | else 83 | CMAKE_FOR_NEON="" 84 | fi 85 | 86 | if [ "$USE_OPENCL" == "YES" ] || [ "$USE_OPENCL" == "yes" ] || [ "$USE_OPENCL" == "ON" ] || [ "$USE_OPENCL" == "on" ] || [ "$USE_OPENCL" == "1" ] 87 | then 88 | CMAKE_FOR_OPENCL=" -DARMCOMPUTECL=1 " 89 | else 90 | CMAKE_FOR_OPENCL="" 91 | fi 92 | 93 | ################ OSX's "native" LLVM support: ######################## 94 | 95 | if [ "$CK_DLL_EXT" == ".dylib" ] && [ -n "$CK_ENV_COMPILER_LLVM_SET" ] && [ "$CK_ARMNN_BUILD_TESTS" == "" ] 96 | then 97 | CK_ARMNN_BUILD_TESTS="NO" 98 | fi 99 | 100 | ################ Default for Linuxes is "YES": ####################### 101 | 102 | if [ "$CK_ARMNN_BUILD_TESTS" == "" ] 103 | then 104 | CK_ARMNN_BUILD_TESTS="YES" 105 | fi 106 | 107 | ############################################################ 108 | echo "" 109 | echo "=====[ Running the following cmake command line to build ArmNN: ]=====" 110 | echo "" 111 | 112 | rm -rf "${ARMNN_BUILD_DIR}" 113 | mkdir ${ARMNN_BUILD_DIR} 114 | cd ${ARMNN_BUILD_DIR} 115 | 116 | ##################################################################################### 117 | # 118 | # When using cmake to link a project, make sure to avoid "library path stripping" 119 | # by emptying $LIBRARY_PATH prior to running cmake: 120 | # 121 | # https://cmake.org/pipermail/cmake/2011-June/044782.html 122 | # https://github.com/ARM-software/armnn/issues/226 123 | # 124 | ##################################################################################### 125 | export LIBRARY_PATH= 126 | echo "LIBRARY_PATH === ${LIBRARY_PATH}" 127 | echo "LD_LIBRARY_PATH === ${LD_LIBRARY_PATH}" 128 | 129 | read -d '' CMK_CMD <>$/patch.\\$<>$/* \\$<>$/patch.variations/\\$<>$ \\$<>$/patch.variations/\\$<>$ \\$<>$/patch.variations/\\$<>$ \\$<>$/patch.variations/\\$<>$ \\$<>$/patch.variations/\\$<>$", 11 | "PACKAGE_PATCH__REL_18_08__REMOVE_MALLOC": "", 12 | "PACKAGE_PATCH__REL_19_05__INSTALL_TFLITE_PARSER": "", 13 | "PACKAGE_PATCH__REL_19_08__NO_WERROR": "", 14 | "PACKAGE_PATCH__REL_20_05__NO_WERROR": "", 15 | "PACKAGE_PATCH__REL_20_05__HARDSWISH": "", 16 | "PACKAGE_SKIP_CLEAN_OBJ": "YES", 17 | "PACKAGE_SKIP_CLEAN_SRC_DIR": "YES", 18 | "PACKAGE_SUB_DIR": "src", 19 | "PACKAGE_URL": "https://github.com/arm-software/armnn", 20 | "PACKAGE_VERSION": "release", 21 | "USE_NEON": "NO", 22 | "USE_OPENCL": "NO", 23 | "USE_TF": "NO", 24 | "USE_TFLITE": "NO", 25 | "USE_ONNX": "NO", 26 | "EXTRA_FLAGS": "-Werror", 27 | "CK_ARMNN_CMAKE_VERBOSE": "OFF", 28 | "CK_ARMNN_BUILD_TESTS": "" 29 | }, 30 | "use_git_revision": "yes" 31 | }, 32 | "deps": { 33 | "lib-boost": { 34 | "local": "yes", 35 | "name": "Boost library", 36 | "skip_default": "yes", 37 | "add_dict": "yes", 38 | "sort": 10, 39 | "tags": "lib,boost,for-armnn", 40 | "update_tags_if_env": { 41 | "shared": [ { "CK_TARGET_OS_ID": "android" } ] 42 | }, 43 | "version_from": [ 44 | 1, 45 | 64, 46 | 0 47 | ], 48 | "version_to": [ 49 | 1, 50 | 66, 51 | 0 52 | ] 53 | }, 54 | "lib-protobuf": { 55 | "local": "yes", 56 | "name": "ProtoBuf library", 57 | "only_for_target_os_tags": [ 58 | "android" 59 | ], 60 | "skip_default": "yes", 61 | "sort": 20, 62 | "tags": "lib,protobuf", 63 | "version_from": [ 64 | 3, 65 | 5, 66 | 0 67 | ], 68 | "version_to": [ 69 | 3, 70 | 5, 71 | 1 72 | ] 73 | }, 74 | "lib-protobuf-host": { 75 | "force_target_as_host": "yes", 76 | "local": "yes", 77 | "name": "ProtoBuf host compiler", 78 | "skip_default": "yes", 79 | "sort": 25, 80 | "tags": "lib,protobuf-host", 81 | "version_from": [ 82 | 3, 83 | 5, 84 | 0 85 | ], 86 | "version_to": [ 87 | 3, 88 | 5, 89 | 1 90 | ] 91 | }, 92 | "tensorflow-source": { 93 | "force_target_as_host": "yes", 94 | "enable_if_env": [ 95 | { "USE_TF": ["on", "ON", "yes", "YES", "true", "TRUE", "1"] }, 96 | { "USE_TFLITE": ["on", "ON", "yes", "YES", "true", "TRUE", "1"] } 97 | ], 98 | "local": "yes", 99 | "name": "Tensorflow source", 100 | "sort": 30, 101 | "tags": "tensorflow,source,rel.1.15" 102 | }, 103 | "lib-armcl-variation": { 104 | "enable_if_env": [ 105 | { "USE_NEON": ["on", "ON", "yes", "YES", "true", "TRUE", "1"] }, 106 | { "USE_OPENCL": ["on", "ON", "yes", "YES", "true", "TRUE", "1"] } 107 | ], 108 | "local": "yes", 109 | "name": "Arm Compute Library (either release or development version) with Neon or OpenCL support", 110 | "sort": 40, 111 | "tags": "lib,armcl,viascons", 112 | "update_tags_if_env" : { 113 | "rel.18.08": [ { "PACKAGE_VERSION": "18.08" } ], 114 | "rel.18.11": [ { "PACKAGE_VERSION": "18.11" } ], 115 | "rel.19.02": [ { "PACKAGE_VERSION": "19.02" } ], 116 | "rel.19.05": [ { "PACKAGE_VERSION": "19.05" } ], 117 | "rel.19.08": [ { "PACKAGE_VERSION": "19.08" } ], 118 | "rel.20.05": [ { "PACKAGE_VERSION": "20.05" } ], 119 | "rel.20.08": [ { "PACKAGE_VERSION": "20.08" } ], 120 | "release": [ { "PACKAGE_VERSION": "release" } ], 121 | "dev": [ { "PACKAGE_VERSION": "dev" } ], 122 | "neon": [ { "USE_NEON": ["on", "ON", "yes", "YES", "true", "TRUE", "1"] } ], 123 | "opencl": [ { "USE_OPENCL": ["on", "ON", "yes", "YES", "true", "TRUE", "1"] } ] 124 | } 125 | }, 126 | "lib-flatbuffers": { 127 | "enable_if_env": [ 128 | { "USE_TFLITE": ["on", "ON", "yes", "YES", "true", "TRUE", "1"] } 129 | ], 130 | "local": "yes", 131 | "name": "Google FlatBuffers library", 132 | "sort": 50, 133 | "tags": "lib,flatbuffers" 134 | }, 135 | "compiler": { 136 | "local": "yes", 137 | "name": "C++ compiler", 138 | "sort": 60, 139 | "tags": "compiler,lang-cpp" 140 | }, 141 | "cmake": { 142 | "force_target_as_host": "yes", 143 | "local": "yes", 144 | "name": "CMake", 145 | "sort": 70, 146 | "tags": "cmake" 147 | } 148 | }, 149 | "end_full_path_universal": "install$#sep#$lib$#sep#$libarmnn$#file_ext_dll#$", 150 | "need_cpu_info": "yes", 151 | "only_for_host_os_tags": [ 152 | "linux" 153 | ], 154 | "only_for_target_os_tags": [ 155 | "linux", 156 | "android" 157 | ], 158 | "process_script": "install", 159 | "soft_uoa": "lib.armnn", 160 | "suggested_path": "lib-armnn", 161 | "tags": [ 162 | "lib", 163 | "armnn" 164 | ], 165 | "variations": { 166 | "release": { 167 | "extra_env": { 168 | "PACKAGE_VERSION": "release" 169 | } 170 | }, 171 | "rel.18.08": { 172 | "extra_env": { 173 | "PACKAGE_GIT_CHECKOUT": "v18.08", 174 | "PACKAGE_VERSION": "18.08", 175 | "PACKAGE_PATCH__REL_18_08__REMOVE_MALLOC": "rel.18.08_malloc-to-stdlib.patch", 176 | "ONNX_BRANCH": "--branch rel-1.3.0", 177 | "ONNX_BRANCH_comment": "have to downgrade ONNX version for compatibility (see https://github.com/ARM-software/armnn/issues/113)" 178 | } 179 | }, 180 | "rel.18.11": { 181 | "extra_env": { 182 | "PACKAGE_GIT_CHECKOUT": "v18.11", 183 | "PACKAGE_VERSION": "18.11", 184 | "PACKAGE_PATCH__REL_18_08__REMOVE_MALLOC": "rel.18.08_malloc-to-stdlib.patch", 185 | "ONNX_BRANCH": "--branch rel-1.3.0", 186 | "ONNX_BRANCH_comment": "have to downgrade ONNX version for compatibility (see https://github.com/ARM-software/armnn/issues/113)" 187 | } 188 | }, 189 | "rel.19.02": { 190 | "extra_env": { 191 | "PACKAGE_GIT_CHECKOUT": "v19.02", 192 | "PACKAGE_VERSION": "19.02", 193 | "PACKAGE_PATCH__REL_18_08__REMOVE_MALLOC": "rel.18.08_malloc-to-stdlib.patch", 194 | "ONNX_BRANCH": "--branch rel-1.6.0" 195 | } 196 | }, 197 | "rel.19.05": { 198 | "extra_env": { 199 | "PACKAGE_GIT_CHECKOUT": "v19.05", 200 | "PACKAGE_VERSION": "19.05", 201 | "PACKAGE_PATCH__REL_18_08__REMOVE_MALLOC": "rel.18.08_malloc-to-stdlib.patch", 202 | "PACKAGE_PATCH__REL_19_05__INSTALL_TFLITE_PARSER": "rel.19.05_install-tflite-parser.patch", 203 | "ONNX_BRANCH": "--branch rel-1.6.0" 204 | } 205 | }, 206 | "rel.19.08": { 207 | "extra_env": { 208 | "PACKAGE_GIT_CHECKOUT": "v19.08", 209 | "PACKAGE_PATCH__REL_19_08__NO_WERROR": "rel.19.08_no-werror.patch", 210 | "PACKAGE_VERSION": "19.08", 211 | "ONNX_BRANCH": "--branch rel-1.6.0" 212 | } 213 | }, 214 | "rel.20.05": { 215 | "extra_env": { 216 | "PACKAGE_GIT_CHECKOUT": "v20.05", 217 | "PACKAGE_PATCH__REL_20_05__NO_WERROR": "rel.20.05_no-werror.patch", 218 | "PACKAGE_PATCH__REL_20_05__HARDSWISH": "rel.20.05_hardswish.patch", 219 | "PACKAGE_VERSION": "20.05", 220 | "ONNX_BRANCH": "--branch rel-1.6.0" 221 | } 222 | }, 223 | "rel.20.08": { 224 | "extra_env": { 225 | "PACKAGE_GIT_CHECKOUT": "v20.08", 226 | "PACKAGE_VERSION": "20.08", 227 | "ONNX_BRANCH": "--branch rel-1.6.0" 228 | } 229 | }, 230 | "dev": { 231 | "extra_env": { 232 | "PACKAGE_URL": "https://review.mlplatform.org/ml/armnn", 233 | "PACKAGE_PATCH__REL_20_05__NO_WERROR": "rel.20.05_no-werror.patch", 234 | "PACKAGE_VERSION": "dev", 235 | "ONNX_BRANCH": "--branch rel-1.7.0", 236 | "ONNX_BRANCH_comment": "Deliberately setting a different ONNX branch from rel.20.05 as it seems to fail" 237 | } 238 | }, 239 | "neon": { 240 | "extra_env": { 241 | "USE_NEON": "YES" 242 | } 243 | }, 244 | "opencl": { 245 | "extra_env": { 246 | "USE_OPENCL": "YES" 247 | } 248 | }, 249 | "tf": { 250 | "extra_env": { 251 | "USE_TF": "YES" 252 | } 253 | }, 254 | "tflite": { 255 | "extra_env": { 256 | "USE_TFLITE": "YES" 257 | } 258 | }, 259 | "onnx": { 260 | "extra_env": { 261 | "USE_ONNX": "YES" 262 | } 263 | }, 264 | "with_tests": { 265 | "extra_env": { 266 | "CK_ARMNN_BUILD_TESTS": "YES" 267 | } 268 | }, 269 | "without_tests": { 270 | "extra_env": { 271 | "CK_ARMNN_BUILD_TESTS": "NO" 272 | } 273 | } 274 | }, 275 | "use_preprocess_scripts_from_another_entry": { 276 | "data_uoa": "process-compiler-for-cmake", 277 | "module_uoa": "script" 278 | }, 279 | "use_scripts_from_another_entry": { 280 | "data_uoa": "download-and-install-package", 281 | "module_uoa": "script" 282 | } 283 | } 284 | -------------------------------------------------------------------------------- /program/mnist-armnn-tf/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------