From eb9392222be1ac7c39bee369477ad2b5f43031c4 Mon Sep 17 00:00:00 2001 From: liuqi Date: Mon, 18 Dec 2017 18:10:57 +0800 Subject: [PATCH] Add bazel build opt to support multiple model for mace_run. --- mace/examples/mace_run.cc | 4 ++-- tools/validate_gcn.sh | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mace/examples/mace_run.cc b/mace/examples/mace_run.cc index aedcbfbc..cb285ad3 100644 --- a/mace/examples/mace_run.cc +++ b/mace/examples/mace_run.cc @@ -21,7 +21,7 @@ using namespace std; using namespace mace; namespace mace { -extern NetDef CreateGCN512(); +extern NetDef MACE_MODEL_FUNCTION(); } void ParseShape(const string &str, vector *shape) { string tmp = str; @@ -95,7 +95,7 @@ int main(int argc, char **argv) { // NetDef net_def; // net_def.ParseFromIstream(&file_stream); // file_stream.close(); - NetDef net_def = mace::CreateGCN512(); + NetDef net_def = mace::MACE_MODEL_FUNCTION(); DeviceType device_type = ParseDeviceType(device); VLOG(0) << device_type; diff --git a/tools/validate_gcn.sh b/tools/validate_gcn.sh index 930e3e3b..99a245a1 100644 --- a/tools/validate_gcn.sh +++ b/tools/validate_gcn.sh @@ -46,10 +46,12 @@ bazel-bin/mace/python/tools/tf_converter --input=${TF_MODEL_FILE_PATH} \ # Step 3: Run model on the phone echo "Step 3: Run model on the phone" +echo Create${MODEL_TAG} bazel build -c opt --strip always mace/examples:mace_run \ --crosstool_top=//external:android/crosstool \ --host_crosstool_top=@bazel_tools//tools/cpp:toolchain \ - --cpu=arm64-v8a + --cpu=arm64-v8a \ + --copt=-DMACE_MODEL_FUNCTION=Create${MODEL_TAG} adb shell "mkdir -p ${PHONE_DATA_DIR}" adb shell "mkdir -p ${KERNEL_DIR}" -- GitLab