Fix unittest (#29412)

* fix tensorrt unittest precision error

* fix unittest precision error. test_trt_subgraph_pass && test_trt_dynamic_shape_transformer_prune
revert-31562-mean
Shang Zhizhou 5 years ago committed by GitHub
parent f860de4af7
commit 225a9c4ed8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -126,7 +126,7 @@ void trt_ernie(bool with_fp16, std::vector<float> result) {
run(config, &out_data);
for (size_t i = 0; i < out_data.size(); i++) {
EXPECT_NEAR(result[i], out_data[i], 1e-4);
EXPECT_NEAR(result[i], out_data[i], 2e-3);
}
}

@ -308,7 +308,10 @@ class TensorRTSubgraphPassActivationTest(InferencePassTest):
use_gpu = True
if os.path.exists(self.path + "_opt_cache"):
shutil.rmtree(self.path + "_opt_cache")
self.check_output_with_option(use_gpu)
if self.trt_parameters.precision == AnalysisConfig.Precision.Float32:
self.check_output_with_option(use_gpu)
else:
self.check_output_with_option(use_gpu, 1e-3)
self.assertTrue(
PassVersionChecker.IsCompatible('tensorrt_subgraph_pass'))
@ -572,7 +575,7 @@ class TensorRTSubgraphPassDynamicSplitFp16SerializeTest(InferencePassTest):
use_gpu = True
if os.path.exists(self.path + "_opt_cache"):
shutil.rmtree(self.path + "_opt_cache")
self.check_output_with_option(use_gpu)
self.check_output_with_option(use_gpu, 1e-3)
self.assertTrue(
PassVersionChecker.IsCompatible('tensorrt_subgraph_pass'))

Loading…
Cancel
Save