提交 a25bd499 编写于 作者: L Liangliang He

Fix generated lib and hexagon lib dependency issue

上级 56dbe745
......@@ -33,7 +33,15 @@ config_setting(
)
config_setting(
name = "enable_neon",
name = "production_mode",
define_values = {
"production": "true",
},
visibility = ["//visibility:public"],
)
config_setting(
name = "neon_enabled",
define_values = {
"neon": "true",
},
......@@ -41,9 +49,13 @@ config_setting(
)
config_setting(
name = "embed_binary_program",
name = "hexagon_enabled",
define_values = {
"embed_binary_program": "true",
"hexagon": "true",
},
values = {
"crosstool_top": "//external:android/crosstool",
"cpu": "armeabi-v7a",
},
visibility = ["//visibility:public"],
)
......@@ -5,52 +5,36 @@ package(
default_visibility = ["//visibility:public"],
)
load("//mace:mace.bzl", "if_embed_binary_program", "if_use_source_program")
cc_library(
name = "generated_models_lib",
name = "generated_models",
srcs = glob(["models/*/*.cc"]),
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
linkstatic = 1,
deps = [
"//mace/core",
"//mace/ops",
] + if_embed_binary_program(["//mace/core:opencl_binary_linkage"]) +
if_use_source_program(["//mace/core:opencl_source_linkage"]) + [
"//mace/codegen:version_lib",
"//mace/codegen:generated_opencl_source_lib",
"//mace/codegen:generated_opencl_compiled_lib",
"//mace/codegen:generated_tuning_lib",
],
)
cc_library(
name = "generated_opencl_source_lib",
srcs = glob(["opencl/opencl_encrypt_program.cc"]),
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
name = "generated_opencl_dev",
srcs = ["opencl/opencl_encrypt_program.cc"],
linkstatic = 1,
)
cc_library(
name = "generated_opencl_compiled_lib",
srcs = glob(["opencl/opencl_compiled_program.cc"]),
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
name = "generated_opencl_prod",
srcs = ["opencl/opencl_compiled_program.cc"],
linkstatic = 1,
)
cc_library(
name = "generated_tuning_lib",
srcs = glob(["tuning/*.cc"]),
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
name = "generated_tuning_params",
srcs = ["tuning/tuning_params.cc"],
linkstatic = 1,
)
cc_library(
name = "version_lib",
srcs = glob(["version/*.cc"]),
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
name = "generated_version",
srcs = ["version/version.cc"],
linkstatic = 1,
deps = [
"//mace/core",
]
)
......@@ -7,25 +7,34 @@ package(
licenses(["notice"]) # Apache 2.0
load("//mace:mace.bzl", "if_android", "if_android_armv7", "if_android_arm64",
"if_profiling_enabled")
load(
"//mace:mace.bzl",
"if_android",
"if_profiling_enabled",
"if_hexagon_enabled",
"if_not_hexagon_enabled",
"if_production_mode",
"if_not_production_mode",
)
cc_library(
name = "core",
srcs = glob([
"*.cc",
"runtime/opencl/*.cc",
"runtime/hexagon/*.cc",
],
exclude = [
"runtime/opencl/opencl_binary_linkage.cc",
"runtime/opencl/opencl_source_linkage.cc",
"*_test.cc",
srcs = glob(
[
"*.cc",
"runtime/opencl/*.cc",
"runtime/hexagon/*.cc",
],
exclude = [
"runtime/opencl/opencl_prod.cc",
"runtime/opencl/opencl_dev.cc",
"*_test.cc",
"runtime/hexagon/hexagon_controller_dummy.cc",
],
) + if_not_hexagon_enabled([
"runtime/hexagon/hexagon_controller_dummy.cc",
]) + if_android_armv7([
]) + if_hexagon_enabled([
"runtime/hexagon/libhexagon_controller.so",
]) + if_android_arm64([
"runtime/hexagon/hexagon_controller_dummy.cc",
]),
hdrs = glob([
"*.h",
......@@ -34,13 +43,31 @@ cc_library(
"runtime/opencl/*.h",
"runtime/hexagon/*.h",
]),
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"] +
if_profiling_enabled(["-DMACE_OPENCL_PROFILING"]),
linkopts = if_android(["-pie", "-ldl"]),
copts = if_profiling_enabled(["-DMACE_OPENCL_PROFILING"]) + if_hexagon_enabled(["-DMACE_HEXAGON_ENABLED"]),
linkopts = if_android([
"-pie",
"-ldl",
]),
deps = [
"//mace/utils:utils_hdrs",
":opencl_headers",
"//mace/utils:logging",
"//mace/utils:tuner",
"//mace/utils:utils_hdrs",
"//mace/codegen:generated_version",
] + if_production_mode([
"//mace/core:opencl_prod",
]) + if_not_production_mode([
"//mace/core:opencl_dev",
]),
)
cc_library(
name = "opencl_headers",
hdrs = glob([
"runtime/opencl/cl2.hpp",
"runtime/opencl/*.h",
]),
deps = [
"@opencl_headers//:opencl20_headers",
],
)
......@@ -48,37 +75,37 @@ cc_library(
cc_library(
name = "test_benchmark_main",
testonly = 1,
hdrs = [
"testing/test_benchmark.h",
],
srcs = [
"testing/test_benchmark.cc",
"testing/test_benchmark_main.cc",
],
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
alwayslink = 1,
hdrs = [
"testing/test_benchmark.h",
],
deps = [
":core",
"//mace/utils:utils_hdrs",
],
alwayslink = 1,
)
cc_library(
name = "opencl_source_linkage",
srcs = ["runtime/opencl/opencl_source_linkage.cc"],
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
name = "opencl_dev",
srcs = ["runtime/opencl/opencl_development.cc"],
linkstatic = 1,
deps = [
":core",
":opencl_headers",
"//mace/codegen:generated_opencl_dev",
],
)
cc_library(
name = "opencl_binary_linkage",
srcs = ["runtime/opencl/opencl_binary_linkage.cc"],
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
name = "opencl_prod",
srcs = ["runtime/opencl/opencl_production.cc"],
linkstatic = 1,
deps = [
":core",
":opencl_headers",
"//mace/codegen:generated_opencl_prod",
"//mace/codegen:generated_tuning_params",
],
)
......@@ -11,6 +11,28 @@
namespace mace {
#define MACE_MAJOR_VERSION 0
#define MACE_MINOR_VERSION 1
#define MACE_PATCH_VERSION 0
// MACE_VERSION_SUFFIX is non-empty for pre-releases (e.g. "-alpha", "-alpha.1",
// "-beta", "-rc", "-rc.1")
#define MACE_VERSION_SUFFIX ""
#define MACE_STR_HELPER(x) #x
#define MACE_STR(x) MACE_STR_HELPER(x)
// e.g. "0.5.0" or "0.6.0-alpha".
#define MACE_VERSION_STRING \
(MACE_STR(MACE_MAJOR_VERSION) "." MACE_STR(MACE_MINOR_VERSION) "." MACE_STR( \
MACE_PATCH_VERSION) MACE_VERSION_SUFFIX)
inline const char *MaceVersion() {
return MACE_VERSION_STRING;
}
extern const char *MaceGitVersion();
enum NetMode {
INIT = 0,
NORMAL = 1
......
//
// Copyright (c) 2017 XiaoMi All rights reserved.
//
#ifndef MACE_CORE_PUBLIC_VERSION_H_
#define MACE_CORE_PUBLIC_VERSION_H_
#define MACE_MAJOR_VERSION 0
#define MACE_MINOR_VERSION 1
#define MACE_PATCH_VERSION 0
// MACE_VERSION_SUFFIX is non-empty for pre-releases (e.g. "-alpha", "-alpha.1",
// "-beta", "-rc", "-rc.1")
#define MACE_VERSION_SUFFIX ""
#define MACE_STR_HELPER(x) #x
#define MACE_STR(x) MACE_STR_HELPER(x)
// e.g. "0.5.0" or "0.6.0-alpha".
#define MACE_VERSION_STRING \
(MACE_STR(MACE_MAJOR_VERSION) "." MACE_STR(MACE_MINOR_VERSION) "." MACE_STR( \
MACE_PATCH_VERSION) MACE_VERSION_SUFFIX)
extern const char *MaceVersion();
extern const char *MaceGitVersion();
#endif // MACE_CORE_PUBLIC_VERSION_H_
......@@ -49,18 +49,17 @@ bool GetTuningParams(const char *path,
if (path != nullptr) {
std::ifstream ifs(path, std::ios::binary | std::ios::in);
if (ifs.is_open()) {
int32_t key_size = 0;
int32_t params_size = 0;
int32_t params_count = 0;
int64_t num_pramas = 0;
ifs.read(reinterpret_cast<char *>(&num_pramas), sizeof(num_pramas));
while (num_pramas--) {
int64_t num_params = 0;
ifs.read(reinterpret_cast<char *>(&num_params), sizeof(num_params));
while (num_params--) {
int32_t key_size = 0;
ifs.read(reinterpret_cast<char *>(&key_size), sizeof(key_size));
std::string key(key_size, ' ');
ifs.read(&key[0], key_size);
int32_t params_size = 0;
ifs.read(reinterpret_cast<char *>(&params_size), sizeof(params_size));
params_count = params_size / sizeof(unsigned int);
int32_t params_count = params_size / sizeof(unsigned int);
std::vector<unsigned int> params(params_count);
for (int i = 0; i < params_count; ++i) {
ifs.read(reinterpret_cast<char *>(&params[i]), sizeof(unsigned int));
......
# Examples
load("//mace:mace.bzl", "if_android", "if_enable_neon")
load("//mace:mace.bzl", "if_android", "if_neon_enabled")
cc_binary(
name = "helloworld",
srcs = [
"helloworld.cc",
],
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
linkopts = if_enable_neon(["-fopenmp"]),
linkopts = if_neon_enabled(["-fopenmp"]),
deps = [
"//mace/core",
"//mace/ops",
......@@ -18,8 +17,7 @@ cc_test(
name = "benchmark_example",
testonly = 1,
srcs = ["benchmark_example.cc"],
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
linkopts = if_enable_neon(["-fopenmp"]),
linkopts = if_neon_enabled(["-fopenmp"]),
linkstatic = 1,
deps = [
"//mace/core",
......@@ -30,11 +28,10 @@ cc_test(
cc_binary(
name = "mace_run",
srcs = ["mace_run.cc"],
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
linkopts = if_enable_neon(["-fopenmp"]),
linkopts = if_neon_enabled(["-fopenmp"]),
linkstatic = 1,
deps = [
"//mace/codegen:generated_models_lib",
"//mace/codegen:generated_models",
"//mace/utils:command_line_flags",
],
)
......@@ -23,7 +23,6 @@
#include "mace/utils/logging.h"
#include "mace/core/public/mace.h"
#include "mace/core/public/version.h"
using namespace std;
using namespace mace;
......
......@@ -7,22 +7,23 @@ package(
licenses(["notice"]) # Apache 2.0
load("//mace:mace.bzl", "if_android", "if_enable_neon")
load("//mace:mace.bzl", "if_android", "if_neon_enabled")
cc_library(
name = "kernels",
srcs = glob(["*.cc", "opencl/*.cc"]) + if_enable_neon(glob([
srcs = glob([
"*.cc",
"opencl/*.cc",
]) + if_neon_enabled(glob([
"neon/*.cc",
])),
hdrs = glob(["*.h", "opencl/*.h"]) + if_enable_neon(glob([
hdrs = glob([
"*.h",
"opencl/*.h",
]) + if_neon_enabled(glob([
"neon/*.h",
])),
copts = [
"-std=c++11",
"-D_GLIBCXX_USE_C99_MATH_TR1",
"-Werror=return-type",
] +
if_enable_neon(["-fopenmp"]),
copts = if_neon_enabled(["-fopenmp"]),
linkopts = if_android(["-lm"]),
deps = [
"//mace/core",
......@@ -34,7 +35,6 @@ cc_test(
name = "kernel_test",
testonly = 1,
srcs = glob(["test/*.cc"]),
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
linkopts = if_android(["-pie"]),
linkstatic = 1,
deps = [
......@@ -48,7 +48,6 @@ cc_test(
name = "benchmark",
testonly = 1,
srcs = glob(["benchmark/*.cc"]),
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
linkstatic = 1,
deps = [
":kernels",
......
......@@ -30,20 +30,32 @@ def if_profiling_enabled(a):
"//conditions:default": [],
})
def if_embed_binary_program(a):
def if_production_mode(a):
return select({
"//mace:embed_binary_program": a,
"//mace:production_mode": a,
"//conditions:default": [],
})
def if_use_source_program(a):
def if_not_production_mode(a):
return select({
"//mace:embed_binary_program": [],
"//mace:production_mode": [],
"//conditions:default": a,
})
def if_enable_neon(a):
def if_neon_enabled(a):
return select({
"//mace:enable_neon": a,
"//mace:neon_enabled": a,
"//conditions:default": [],
})
def if_hexagon_enabled(a):
return select({
"//mace:hexagon_enabled": a,
"//conditions:default": [],
})
def if_not_hexagon_enabled(a):
return select({
"//mace:hexagon_enabled": [],
"//conditions:default": a,
})
......@@ -7,7 +7,7 @@ package(
licenses(["notice"]) # Apache 2.0
load("//mace:mace.bzl", "if_android", "if_enable_neon")
load("//mace:mace.bzl", "if_android", "if_neon_enabled")
cc_library(
name = "test",
......@@ -34,8 +34,7 @@ cc_library(
["*.h"],
exclude = ["ops_test_util.h"],
),
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"] +
if_enable_neon(["-DMACE_ENABLE_NEON"]),
copts = if_neon_enabled(["-DMACE_ENABLE_NEON"]),
deps = [
"//mace/kernels",
],
......@@ -48,7 +47,6 @@ cc_test(
srcs = glob(
["*_test.cc"],
),
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
linkopts = ["-fopenmp"],
linkstatic = 1,
deps = [
......@@ -62,7 +60,6 @@ cc_test(
name = "ops_benchmark",
testonly = 1,
srcs = glob(["*_benchmark.cc"]),
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
linkopts = ["-fopenmp"],
linkstatic = 1,
deps = [
......
......@@ -7,7 +7,6 @@ cc_library(
name = "stat_summarizer",
srcs = ["stat_summarizer.cc"],
hdrs = ["stat_summarizer.h"],
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
linkstatic = 1,
deps = [
"//mace/core",
......@@ -19,7 +18,6 @@ cc_binary(
srcs = [
"benchmark_model.cc",
],
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
linkstatic = 1,
deps = [
":stat_summarizer",
......
......@@ -18,7 +18,13 @@ else
fi
cat <<EOF > ${OUTPUT_FILENAME}
#include "mace/core/public/version.h"
const char *MaceVersion() { return MACE_VERSION_STRING; }
const char *MaceGitVersion() { return "${GIT_VERSION}"; }
//
// Copyright (c) 2017 XiaoMi All rights reserved.
//
// This is a generated file, DO NOT EDIT
namespace mace {
const char *MaceGitVersion() { return "${GIT_VERSION}"; }
} // namespace mace
EOF
......@@ -17,7 +17,6 @@ cc_library(
hdrs = [
"logging.h",
],
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
linkopts = if_android([
"-llog",
]),
......@@ -31,7 +30,6 @@ cc_library(
hdrs = [
"command_line_flags.h",
],
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
deps = [
":logging",
],
......@@ -40,13 +38,12 @@ cc_library(
cc_library(
name = "tuner",
hdrs = [
"tuner.h",
"timer.h",
"tuner.h",
],
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
deps = [
":utils_hdrs",
":logging",
":utils_hdrs",
],
)
......@@ -56,8 +53,10 @@ cc_test(
srcs = [
"tuner_test.cc",
],
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
linkopts = if_android(["-pie", "-lm"]),
linkopts = if_android([
"-pie",
"-lm",
]),
linkstatic = 1,
deps = [
":tuner",
......@@ -69,19 +68,17 @@ cc_test(
cc_library(
name = "utils_hdrs",
hdrs = [
"utils.h",
"env_time.h",
"utils.h",
],
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
)
cc_library(
name = "utils",
deps = [
":utils_hdrs",
":tuner",
":command_line_flags",
":logging",
":tuner",
":utils_hdrs",
],
copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"],
)
......@@ -6,7 +6,7 @@ if [ "$#" -lt 1 ]; then
fi
MACE_SOURCE_DIR=`/bin/pwd`
CL_CODEGEN_DIR=${MACE_SOURCE_DIR}/mace/codegen/opencl
CODEGEN_DIR=${MACE_SOURCE_DIR}/mace/codegen
DEVICE_PATH=/data/local/tmp/mace
DEVICE_CL_PATH=$DEVICE_PATH/cl/
BAZEL_TARGET=$1
......@@ -24,25 +24,28 @@ STRIP="--strip always"
VLOG_LEVEL=0
PROFILINE="--define profiling=true"
BRANCH=$(git symbolic-ref --short HEAD)
COMMIT_ID=$(git rev-parse --short HEAD)
echo "Step 1: Generate encrypted opencl source"
python mace/python/tools/encrypt_opencl_codegen.py \
--cl_kernel_dir=./mace/kernels/opencl/cl/ --output_path=${CL_CODEGEN_DIR}/opencl_encrypt_program.cc
--cl_kernel_dir=./mace/kernels/opencl/cl/ --output_path=${CODEGEN_DIR}/opencl/opencl_encrypt_program.cc
echo "Step 2: Generate version source"
bash mace/tools/git/gen_version_source.sh ${CODEGEN_DIR}/version/version.cc
echo "Step 2: Build target"
echo "Step 3: Build target"
bazel build -c opt $STRIP --verbose_failures $BAZEL_TARGET \
--crosstool_top=//external:android/crosstool \
--host_crosstool_top=@bazel_tools//tools/cpp:toolchain \
--cpu=$ANDROID_ABI \
--copt="-std=c++11" \
--copt="-D_GLIBCXX_USE_C99_MATH_TR1" \
--copt="-Werror=return-type" \
--define neon=false
if [ $? -ne 0 ]; then
exit 1
fi
echo "Step 3: Run target"
echo "Step 4: Run target"
du -hs $BAZEL_BIN_PATH/$BIN_NAME
for device in `adb devices | grep "^[A-Za-z0-9]\+[[:space:]]\+device$"| cut -f1`; do
......@@ -50,6 +53,7 @@ for device in `adb devices | grep "^[A-Za-z0-9]\+[[:space:]]\+device$"| cut -f1`
echo "Run on device: ${device}"
adb -s ${device} shell "rm -rf $DEVICE_PATH"
adb -s ${device} shell "mkdir -p $DEVICE_PATH"
adb -s ${device} shell "mkdir -p $DEVICE_PATH/cl"
adb -s ${device} push $BAZEL_BIN_PATH/$BIN_NAME $DEVICE_PATH && \
adb -s ${device} shell "MACE_KERNEL_PATH=$DEVICE_CL_PATH MACE_CPP_MIN_VLOG_LEVEL=$VLOG_LEVEL $DEVICE_PATH/$BIN_NAME $@"
done
......@@ -39,19 +39,22 @@ build_and_run()
EMBED_OPENCL_BINARY_BUILD_FLAGS="--define embed_binary_program=true"
fi
bazel build -c opt --strip always mace/examples:mace_run \
bazel build --verbose_failures -c opt --strip always mace/examples:mace_run \
--crosstool_top=//external:android/crosstool \
--host_crosstool_top=@bazel_tools//tools/cpp:toolchain \
--cpu=arm64-v8a \
$EMBED_OPENCL_BINARY_BUILD_FLAGS \
--copt=-DMACE_MODEL_FUNCTION=Create${MODEL_TAG}
--copt="-std=c++11" \
--copt="-D_GLIBCXX_USE_C99_MATH_TR1" \
--copt="-Werror=return-type" \
--copt="-DMACE_MODEL_FUNCTION=Create${MODEL_TAG}" \
$EMBED_OPENCL_BINARY_BUILD_FLAGS || exit -1
adb shell "mkdir -p ${PHONE_DATA_DIR}"
adb shell "mkdir -p ${PHONE_DATA_DIR}" || exit -1
if [ "$EMBED_OPENCL_BINARY" = false ]; then
adb shell "mkdir -p ${KERNEL_DIR}"
adb shell "mkdir -p ${KERNEL_DIR}" || exit -1
fi
adb push ${MODEL_DIR}/${INPUT_FILE_NAME} ${PHONE_DATA_DIR}
adb push bazel-bin/mace/examples/mace_run ${PHONE_DATA_DIR}
adb push ${MODEL_DIR}/${INPUT_FILE_NAME} ${PHONE_DATA_DIR} || exit -1
adb push bazel-bin/mace/examples/mace_run ${PHONE_DATA_DIR} || exit -1
if [[ "${TUNING_OR_NOT}" != "0" && "$EMBED_OPENCL_BINARY" != true ]];then
tuning_flag=1
......@@ -71,17 +74,17 @@ build_and_run()
--input_file=${PHONE_DATA_DIR}/${INPUT_FILE_NAME} \
--output_file=${PHONE_DATA_DIR}/${OUTPUT_FILE_NAME} \
--device=OPENCL \
--round=$round
--round=$round || exit -1
}
echo "Step 1: Generate input data"
rm -rf ${MODEL_DIR}/${INPUT_FILE_NAME}
python tools/validate.py --generate_data true \
--input_file=${MODEL_DIR}/${INPUT_FILE_NAME} \
--input_shape="${IMAGE_SIZE},${IMAGE_SIZE},3"
--input_shape="${IMAGE_SIZE},${IMAGE_SIZE},3" || exit -1
echo "Step 2: Convert tf model to mace model and optimize memory"
bazel build //mace/python/tools:tf_converter
bazel build //mace/python/tools:tf_converter || exit -1
rm -rf ${MODEL_CODEGEN_DIR}
mkdir -p ${MODEL_CODEGEN_DIR}
bazel-bin/mace/python/tools/tf_converter --input=${TF_MODEL_FILE_PATH} \
......@@ -93,7 +96,7 @@ bazel-bin/mace/python/tools/tf_converter --input=${TF_MODEL_FILE_PATH} \
--output_type=source \
--template=${MACE_SOURCE_DIR}/mace/python/tools/model.template \
--model_tag=${MODEL_TAG} \
--confuse=False
--confuse=False || exit -1
echo "Step 3: Generate version source"
rm -rf ${VERSION_SOURCE_PATH}
......
......@@ -34,7 +34,9 @@ build_and_run()
--crosstool_top=//external:android/crosstool \
--host_crosstool_top=@bazel_tools//tools/cpp:toolchain \
--cpu=armeabi-v7a \
--copt=-DMACE_MODEL_FUNCTION=Create${MODEL_TAG}
--copt="-std=c++11" \
--copt="-D_GLIBCXX_USE_C99_MATH_TR1" \
--copt="-Werror=return-type"
adb shell "mkdir -p ${PHONE_DATA_DIR}"
adb push ${MODEL_DIR}/${INPUT_FILE_NAME} ${PHONE_DATA_DIR}
......@@ -92,4 +94,4 @@ python tools/validate.py --model_file ${TF_MODEL_FILE_PATH} \
--input_node ${TF_INPUT_NODE} \
--output_node ${TF_OUTPUT_NODE} \
--input_shape "${IMAGE_SIZE},${IMAGE_SIZE},3" \
--output_shape "1,${IMAGE_SIZE},${IMAGE_SIZE},2"
\ No newline at end of file
--output_shape "1,${IMAGE_SIZE},${IMAGE_SIZE},2"
文件模式从 100644 更改为 100755
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册