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 caebfe16d6fc8f344b1f337195fda79c485cfc9a..e4b94048188f063d819c446527427007af22a54c 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); } }