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

update demo_ci ut threshold (#41981)

上级 0f72c72c
...@@ -71,7 +71,8 @@ Record ProcessALine(const std::string& line) { ...@@ -71,7 +71,8 @@ Record ProcessALine(const std::string& line) {
return record; 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::string line;
std::ifstream file(referfile); std::ifstream file(referfile);
std::getline(file, line); std::getline(file, line);
...@@ -93,7 +94,7 @@ void CheckOutput(const std::string& referfile, const PaddleTensor& output) { ...@@ -93,7 +94,7 @@ void CheckOutput(const std::string& referfile, const PaddleTensor& output) {
for (size_t i = 0; i < numel; ++i) { for (size_t i = 0; i < numel; ++i) {
CHECK_LT( CHECK_LT(
fabs(static_cast<float*>(output.data.data())[i] - refer.data[i]), fabs(static_cast<float*>(output.data.data())[i] - refer.data[i]),
1e-5); threshold);
} }
break; break;
} }
......
...@@ -71,7 +71,7 @@ void Main(bool use_gpu) { ...@@ -71,7 +71,7 @@ void Main(bool use_gpu) {
auto& tensor = output.front(); auto& tensor = output.front();
// compare with reference result // compare with reference result
CheckOutput(FLAGS_refer, tensor); CheckOutput(FLAGS_refer, tensor, 1e-4);
// the analysis_output has some diff with native_output, // the analysis_output has some diff with native_output,
// TODO(luotao): add CheckOutput for analysis_output later. // 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.
先完成此消息的编辑!
想要评论请 注册