Skip to content

Commit b171aab

Browse files
authored
fix windows ut precession error (#36124)
1 parent 4bcff7b commit b171aab

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

paddle/fluid/inference/api/demo_ci/utils.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ Record ProcessALine(const std::string& line) {
7171
return record;
7272
}
7373

74-
void CheckOutput(const std::string& referfile, const PaddleTensor& output) {
74+
void CheckOutput(const std::string& referfile, const PaddleTensor& output,
75+
const float epsilon = 1e-5) {
7576
std::string line;
7677
std::ifstream file(referfile);
7778
std::getline(file, line);
@@ -93,7 +94,7 @@ void CheckOutput(const std::string& referfile, const PaddleTensor& output) {
9394
for (size_t i = 0; i < numel; ++i) {
9495
CHECK_LT(
9596
fabs(static_cast<float*>(output.data.data())[i] - refer.data[i]),
96-
1e-5);
97+
epsilon);
9798
}
9899
break;
99100
}

paddle/fluid/inference/api/demo_ci/vis_demo.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void Main(bool use_gpu) {
7171
auto& tensor = output.front();
7272

7373
// compare with reference result
74-
CheckOutput(FLAGS_refer, tensor);
74+
CheckOutput(FLAGS_refer, tensor, 1e-3);
7575

7676
// the analysis_output has some diff with native_output,
7777
// TODO(luotao): add CheckOutput for analysis_output later.

0 commit comments

Comments
 (0)