diff --git a/paddle/fluid/inference/api/demo_ci/utils.h b/paddle/fluid/inference/api/demo_ci/utils.h index 5ac00fd294f433be08ad2f058529fc4b35e60e19..2ff5d88300b54853443926f6abe9a504050f170e 100644 --- a/paddle/fluid/inference/api/demo_ci/utils.h +++ b/paddle/fluid/inference/api/demo_ci/utils.h @@ -71,7 +71,8 @@ Record ProcessALine(const std::string& line) { return record; } -void CheckOutput(const std::string& referfile, const PaddleTensor& output) { +void CheckOutput(const std::string& referfile, const PaddleTensor& output, + const float epsilon = 1e-5) { std::string line; std::ifstream file(referfile); std::getline(file, line); @@ -93,7 +94,7 @@ void CheckOutput(const std::string& referfile, const PaddleTensor& output) { for (size_t i = 0; i < numel; ++i) { CHECK_LT( fabs(static_cast(output.data.data())[i] - refer.data[i]), - 1e-5); + epsilon); } break; } diff --git a/paddle/fluid/inference/api/demo_ci/vis_demo.cc b/paddle/fluid/inference/api/demo_ci/vis_demo.cc index 0b3257da92cd3facc7f8f10950ffcd9fa3008bc8..5148c8039e692facc3e22948e5e5faf1da83a65b 100644 --- a/paddle/fluid/inference/api/demo_ci/vis_demo.cc +++ b/paddle/fluid/inference/api/demo_ci/vis_demo.cc @@ -71,7 +71,7 @@ void Main(bool use_gpu) { auto& tensor = output.front(); // compare with reference result - CheckOutput(FLAGS_refer, tensor); + CheckOutput(FLAGS_refer, tensor, 1e-3); // the analysis_output has some diff with native_output, // TODO(luotao): add CheckOutput for analysis_output later.