From 4461a458a58c1bc55fba76256e7d9fd0d5b09486 Mon Sep 17 00:00:00 2001 From: tensor-tang Date: Sun, 13 Jan 2019 07:59:05 +0000 Subject: [PATCH] adjust diff since abs is too large test=develop --- paddle/fluid/inference/tests/api/analyzer_seq_pool1_tester.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/inference/tests/api/analyzer_seq_pool1_tester.cc b/paddle/fluid/inference/tests/api/analyzer_seq_pool1_tester.cc index caebfe16d..e4b940481 100644 --- a/paddle/fluid/inference/tests/api/analyzer_seq_pool1_tester.cc +++ b/paddle/fluid/inference/tests/api/analyzer_seq_pool1_tester.cc @@ -327,7 +327,9 @@ TEST(Analyzer_seq_pool1, zerocopy_compare_native) { native_outputs.front().data.length()); auto *native_data = static_cast(native_outputs.front().data.data()); for (size_t i = 0; i < zerocopy_output.size(); ++i) { - EXPECT_NEAR(zerocopy_output[i], native_data[i], 1e-3); + EXPECT_LT( + std::fabs((zerocopy_output[i] - native_data[i]) / zerocopy_output[i]), + 1e-3); } } -- GitLab