未验证 提交 dbabf5c4 编写于 作者: H hong19860320 提交者: GitHub

[NPU] add NPU supporting for Java API (#1915)

* [NPU] add NPU supporting for Java API
test=develop

* [NPU] refine build script for NPU compiling
test=develop

* [NPU] fix compiling script for NPU
test=develop
上级 b1a8c2a2
......@@ -21,7 +21,7 @@ public class Place {
/** Place hardware target type. */
public enum TargetType {
UNKNOWN(0), HOST(1), X86(2), CUDA(3), ARM(4), OPEN_CL(5), ANY(6);
UNKNOWN(0), HOST(1), X86(2), CUDA(3), ARM(4), OPEN_CL(5), FPGA(7), NPU(8), ANY(6);
public final int value;
......@@ -32,7 +32,7 @@ public class Place {
/** Place precision type */
public enum PrecisionType {
UNKNOWN(0), FLOAT(1), INT8(2), INT32(3), ANY(4);
UNKNOWN(0), FLOAT(1), INT8(2), FP16(5), INT32(3), ANY(4), BOOL(6);
public final int value;
......@@ -43,7 +43,7 @@ public class Place {
/** Place data layout type */
public enum DataLayoutType {
UNKNOWN(0), NCHW(1), ANY(2);
UNKNOWN(0), NCHW(1), NHWC(3), ANY(2);
public final int value;
......
......@@ -7,7 +7,7 @@ function print_usage {
echo "----------------------------------------"
echo -e "--arm_os=<os> android only yet."
echo -e "--arm_abi=<abi> armv8, armv7 yet."
echo -e "--arm_stl=<shared> shared or static"
echo -e "--android_stl=<shared> shared or static"
echo -e "--arm_lang=<gcc> "
echo -e "--ddk_root=<hiai_ddk_root> "
echo -e "--test_name=<test_name>"
......@@ -67,6 +67,7 @@ function cmake_npu {
-DWITH_ARM_DOTPROD=ON \
-DLITE_WITH_LIGHT_WEIGHT_FRAMEWORK=ON \
-DWITH_TESTING=ON \
-DLITE_WITH_JAVA=ON \
-DLITE_WITH_NPU=ON \
-DANDROID_API_LEVEL=24 \
-DARM_TARGET_OS=$1 \
......@@ -88,23 +89,23 @@ function build_npu {
local test_name=test_npu_pass
prepare_thirdparty
if [[ $# -ge 1 ]]; then
os=$1
if [ "x${ARM_OS}" != "x" ]; then
os=$ARM_OS
fi
if [[ $# -ge 2 ]]; then
abi=$2
if [[ "x${ARM_ABI}" != "x" ]]; then
abi=$ARM_ABI
fi
if [[ $# -ge 3 ]]; then
lang=$3
if [[ "x${ARM_LANG}" != "x" ]]; then
lang=$ARM_LANG
fi
if [[ $# -ge 4 ]]; then
stl=$4
if [[ "x${ANDROID_STL}" != "x" ]]; then
stl=$ANDROID_STL
fi
if [[ $# -ge 5 ]]; then
ddk_root=$5
if [[ "x${DDK_ROOT}" != "x" ]]; then
ddk_root=$DDK_ROOT
fi
if [[ $# -ge 6 ]]; then
test_name=$6
if [[ $# -ge 1 ]]; then
test_name=$1
fi
# the c++ symbol is not recognized by the bundled script
......@@ -149,8 +150,20 @@ function main {
ARM_LANG="${i#*=}"
shift
;;
--android_stl=*)
ANDROID_STL="${i#*=}"
shift
;;
--ddk_root=*)
DDK_ROOT="${i#*=}"
shift
;;
build)
build_npu ${os} ${abi} ${lang} ${stl} ${ddk_root} ${test_name}
build_npu $TEST_NAME
shift
;;
full_publish)
build_npu publish_inference
shift
;;
*)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册