提交 b067ce50 编写于 作者: C Chunwei

Merge branch 'chunwei/enhance-api-test' into 'incubate/lite'

enhance api test

See merge request inference/paddlelite!60
......@@ -108,9 +108,12 @@ lite_cc_library(paddle_api_light SRCS paddle_api.cc DEPS light_api_impl_lite)
lite_cc_test(test_paddle_api_lite SRCS paddle_api_test.cc DEPS cxx_api_lite light_api_lite paddle_api_full
${ops_lite}
ARM_DEPS ${arm_kernels}
X86_DEPS ${x86_kernels}
ARGS --model_dir=${LITE_MODEL_DIR}/lite_naive_model SERIAL)
if (WITH_TESTING)
add_dependencies(test_paddle_api_lite test_apis_lite)
add_dependencies(test_paddle_api_lite extern_lite_download_lite_naive_model_tar_gz)
endif()
#lite_cc_binary(cxx_api_lite_bin SRCS cxx_api_bin.cc
......
......@@ -29,7 +29,10 @@ TEST(CxxApi, run) {
lite_api::CxxConfig config;
config.set_model_dir(FLAGS_model_dir);
config.set_preferred_place(Place{TARGET(kX86), PRECISION(kFloat)});
config.set_valid_places({Place{TARGET(kX86), PRECISION(kFloat)}});
config.set_valid_places({
Place{TARGET(kX86), PRECISION(kFloat)},
Place{TARGET(kARM), PRECISION(kFloat)},
});
auto predictor = lite_api::CreatePaddlePredictor(config);
......
......@@ -134,14 +134,26 @@ function test_arm_android {
local testpath=$(find ./paddle/fluid -name ${test_name})
# if [[ "$test_name" == "test_light_api" ]]; then
# local model_path=$(find . -name "lite_naive_model")
# arm_push_necessary_file $port $model_path $adb_work_dir
# fi
adb -s emulator-${port} push ${testpath} ${adb_work_dir}
adb -s emulator-${port} shell "${adb_work_dir}/${test_name}"
}
# test the inference high level api
function test_arm_api {
local port=$1
local test_name="test_paddle_api_lite"
make $test_name -j$NUM_CORES_FOR_COMPILE
local model_path=$(find . -name "lite_naive_model")
local remote_model=${adb_work_dir}/paddle_api
local testpath=$(find ./paddle/fluid -name ${test_name})
arm_push_necessary_file $port $model_path $remote_model
adb -s emulator-${port} shell mkdir -p $remote_model
adb -s emulator-${port} push ${testpath} ${adb_work_dir}
adb -s emulator-${port} shell chmod +x "${adb_work_dir}/${test_name}"
adb -s emulator-${port} shell "./${adb_work_dir}/${test_name}"
adb -s emulator-${port} shell "${adb_work_dir}/${test_name} --model_dir $remote_model"
}
function test_arm_model {
......@@ -258,6 +270,9 @@ function test_arm {
for _test in $(cat $TESTS_FILE); do
test_arm_android $_test $port
done
# test finally
test_arm_api $port
}
function prepare_emulator {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册