未验证 提交 1230c110 编写于 作者: W Wilber 提交者: GitHub

[fluid-lite] adjust to relative error (#22232)

- fluid和lite精度比较替换为相对误差
上级 985bceac
...@@ -377,6 +377,7 @@ inference_analysis_test(lite_mul_model_test SRCS lite_mul_model_test.cc ...@@ -377,6 +377,7 @@ inference_analysis_test(lite_mul_model_test SRCS lite_mul_model_test.cc
inference_analysis_test(lite_resnet50_test SRCS lite_resnet50_test.cc inference_analysis_test(lite_resnet50_test SRCS lite_resnet50_test.cc
EXTRA_DEPS ${INFERENCE_EXTRA_DEPS} EXTRA_DEPS ${INFERENCE_EXTRA_DEPS}
ARGS --infer_model=${RESNET50_MODEL_DIR}) ARGS --infer_model=${RESNET50_MODEL_DIR})
inference_analysis_test(test_analyzer_capi SRCS analyzer_capi_tester.cc inference_analysis_test(test_analyzer_capi SRCS analyzer_capi_tester.cc
EXTRA_DEPS ${INFERENCE_EXTRA_DEPS} paddle_fluid_c EXTRA_DEPS ${INFERENCE_EXTRA_DEPS} paddle_fluid_c
ARGS --infer_model=${RESNET50_MODEL_DIR}/model) ARGS --infer_model=${RESNET50_MODEL_DIR}/model)
......
...@@ -63,7 +63,8 @@ TEST(AnalysisPredictor, use_gpu) { ...@@ -63,7 +63,8 @@ TEST(AnalysisPredictor, use_gpu) {
EXPECT_EQ(outputs.size(), expected_size); EXPECT_EQ(outputs.size(), expected_size);
float* data_o = static_cast<float*>(outputs[0].data.data()); float* data_o = static_cast<float*>(outputs[0].data.data());
for (size_t j = 0; j < outputs[0].data.length() / sizeof(float); j += 10) { for (size_t j = 0; j < outputs[0].data.length() / sizeof(float); j += 10) {
EXPECT_NEAR(data_o[j], truth_values[j / 10], 6e-3); EXPECT_NEAR((data_o[j] - truth_values[j / 10]) / truth_values[j / 10], 0.,
10e-5);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册