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

[XPU] Refine the unit tests (#4457)

上级 7d3ae0ba
......@@ -8,18 +8,17 @@ function(lite_cc_test_with_model_and_data TARGET)
set(multiValueArgs "")
cmake_parse_arguments(args "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(ARGS "")
if(DEFINED args_MODEL)
set(ARGS "${ARGS} --model_dir=${LITE_MODEL_DIR}/${args_MODEL}")
set(ARGS ${ARGS} --model_dir=${LITE_MODEL_DIR}/${args_MODEL})
endif()
if(DEFINED args_DATA)
set(ARGS "${ARGS} --data_dir=${LITE_MODEL_DIR}/${args_DATA}")
set(ARGS ${ARGS} --data_dir=${LITE_MODEL_DIR}/${args_DATA})
endif()
if(DEFINED args_CONFIG)
set(ARGS "${ARGS} --config_dir=${LITE_MODEL_DIR}/${args_CONFIG}")
set(ARGS ${ARGS} --config_dir=${LITE_MODEL_DIR}/${args_CONFIG})
endif()
if(DEFINED args_ARGS)
set(ARGS "${ARGS} ${args_ARGS}")
set(ARGS ${ARGS} ${args_ARGS})
endif()
lite_cc_test(${TARGET} SRCS ${TARGET}.cc
DEPS ${lite_model_test_DEPS} paddle_api_full
......@@ -45,7 +44,7 @@ function(lite_cc_test_with_model_and_data TARGET)
endfunction()
if(LITE_WITH_ARM)
lite_cc_test_with_model_and_data(test_transformer_with_mask_fp32_arm MODEL transformer_with_mask_fp32 ARGS)
lite_cc_test_with_model_and_data(test_transformer_with_mask_fp32_arm MODEL transformer_with_mask_fp32)
endif()
if(LITE_WITH_NPU)
......@@ -55,11 +54,11 @@ if(LITE_WITH_NPU)
endif()
if(LITE_WITH_XPU AND NOT LITE_WITH_XTCL)
lite_cc_test_with_model_and_data(test_resnet50_fp32_xpu MODEL resnet50 DATA ILSVRC2012_small)
lite_cc_test_with_model_and_data(test_googlenet_fp32_xpu MODEL GoogLeNet DATA ILSVRC2012_small)
lite_cc_test_with_model_and_data(test_vgg19_fp32_xpu MODEL VGG19 DATA ILSVRC2012_small)
lite_cc_test_with_model_and_data(test_ernie_fp32_xpu MODEL ernie DATA bert_data)
lite_cc_test_with_model_and_data(test_bert_fp32_xpu MODEL bert DATA bert_data)
lite_cc_test_with_model_and_data(test_resnet50_fp32_baidu_xpu MODEL resnet50 DATA ILSVRC2012_small)
lite_cc_test_with_model_and_data(test_googlenet_fp32_baidu_xpu MODEL GoogLeNet DATA ILSVRC2012_small)
lite_cc_test_with_model_and_data(test_vgg19_fp32_baidu_xpu MODEL VGG19 DATA ILSVRC2012_small)
lite_cc_test_with_model_and_data(test_ernie_fp32_baidu_xpu MODEL ernie DATA bert_data)
lite_cc_test_with_model_and_data(test_bert_fp32_baidu_xpu MODEL bert DATA bert_data)
endif()
if(LITE_WITH_RKNPU)
......
......@@ -30,7 +30,7 @@ DEFINE_int32(iteration, 9, "iteration times to run");
namespace paddle {
namespace lite {
TEST(Bert, test_bert_fp32_xpu) {
TEST(Bert, test_bert_fp32_baidu_xpu) {
lite_api::CxxConfig config;
config.set_model_dir(FLAGS_model_dir);
config.set_valid_places({lite_api::Place{TARGET(kXPU), PRECISION(kFloat)},
......
......@@ -41,7 +41,7 @@ lite::Tensor GetTensorWithShape(std::vector<int64_t> shape) {
return ret;
}
TEST(Ernie, test_ernie_fp32_xpu) {
TEST(Ernie, test_ernie_fp32_baidu_xpu) {
lite_api::CxxConfig config;
config.set_model_dir(FLAGS_model_dir);
config.set_valid_places({lite_api::Place{TARGET(kXPU), PRECISION(kFloat)},
......
......@@ -26,7 +26,7 @@
namespace paddle {
namespace lite {
TEST(ResnetCbam, test_resnet_cbam_fp32_xpu) {
TEST(ResnetCbam, test_resnet_cbam_fp32_baidu_xpu) {
lite_api::CxxConfig config;
// config.set_model_dir(FLAGS_model_dir);
config.set_model_file(FLAGS_model_dir + "/__model__");
......
......@@ -32,7 +32,7 @@ DEFINE_int32(channel, 3, "image channel");
namespace paddle {
namespace lite {
TEST(GoogLeNet, test_googlenet_fp32_xpu) {
TEST(GoogLeNet, test_googlenet_fp32_baidu_xpu) {
lite_api::CxxConfig config;
config.set_model_dir(FLAGS_model_dir);
config.set_valid_places({lite_api::Place{TARGET(kXPU), PRECISION(kFloat)},
......
......@@ -199,7 +199,7 @@ class FileReader {
}
};
TEST(MMDNN, test_mmdnn_fp32_xpu) {
TEST(MMDNN, test_mmdnn_fp32_baidu_xpu) {
lite_api::CxxConfig config;
// config.set_model_dir(FLAGS_model_dir);
config.set_model_file(FLAGS_model_dir + "/__model__");
......
......@@ -32,7 +32,7 @@ DEFINE_int32(channel, 3, "image channel");
namespace paddle {
namespace lite {
TEST(Resnet50, test_resnet50_fp32_xpu) {
TEST(Resnet50, test_resnet50_fp32_baidu_xpu) {
lite_api::CxxConfig config;
config.set_model_dir(FLAGS_model_dir);
config.set_valid_places({lite_api::Place{TARGET(kXPU), PRECISION(kFloat)},
......
......@@ -32,7 +32,7 @@ DEFINE_int32(channel, 3, "image channel");
namespace paddle {
namespace lite {
TEST(VGG19, test_vgg19_fp32_xpu) {
TEST(VGG19, test_vgg19_fp32_baidu_xpu) {
lite_api::CxxConfig config;
config.set_model_dir(FLAGS_model_dir);
config.set_valid_places({lite_api::Place{TARGET(kXPU), PRECISION(kFloat)},
......
......@@ -564,6 +564,8 @@ function run_all_tests_on_adb_device {
fi
# Extract the arguments from ctest command line
test_args=$(echo $(ctest -V -N -R ${test_name}) | sed "/.*${test_name} \"\(.*\)\".*/ s//\1/g")
# Remove the quotes
test_args=$(echo $test_args | sed "s/\"//g")
run_test_case_on_adb_device --adb_device_name=$adb_device_name --adb_work_dir=$adb_work_dir --target_name=$test_name $test_args
done
cd - > /dev/null
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册