未验证 提交 efddf9ea 编写于 作者: B baoachun 提交者: GitHub

update demo_ci ut threshold (#41981) (#42030)

上级 5b9cdd9b
......@@ -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,
float threshold = 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);
threshold);
}
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-4);
// 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.
先完成此消息的编辑!
想要评论请 注册