From 200ee33df80803d4b5c95ef34e22462089af64c0 Mon Sep 17 00:00:00 2001 From: Shang Zhizhou Date: Mon, 1 Feb 2021 19:36:44 +0800 Subject: [PATCH] fix unittest random error (#30808) --- .../tests/unittests/ir/inference/test_trt_slice_plugin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/paddle/fluid/tests/unittests/ir/inference/test_trt_slice_plugin.py b/python/paddle/fluid/tests/unittests/ir/inference/test_trt_slice_plugin.py index d9817c6fe1..6ea2335c7a 100644 --- a/python/paddle/fluid/tests/unittests/ir/inference/test_trt_slice_plugin.py +++ b/python/paddle/fluid/tests/unittests/ir/inference/test_trt_slice_plugin.py @@ -56,7 +56,10 @@ class SlicePluginTRTTest(InferencePassTest): if core.is_compiled_with_cuda(): use_gpu.append(True) for i in range(len(use_gpu)): - self.check_output_with_option(use_gpu[i]) + atol = 1e-5 + if self.trt_parameters.precision == AnalysisConfig.Precision.Half: + atol = 1e-3 + self.check_output_with_option(use_gpu[i], atol) #negative starts && ends -- GitLab