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

fix windows ut precession error (#36124)

上级 4bcff7b2
......@@ -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<float*>(output.data.data())[i] - refer.data[i]),
1e-5);
epsilon);
}
break;
}
......
......@@ -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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册