diff --git a/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_conv2d_transpose.py b/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_conv2d_transpose.py index e21d67839eb6c0f097ca82748c1b7d03ca39d8d3..65fc35f9c56f88fec8fed6b3ecdadb10ddcc8c8f 100644 --- a/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_conv2d_transpose.py +++ b/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_conv2d_transpose.py @@ -37,6 +37,13 @@ class TrtConvertConv2dTransposeTest(TrtLayerAutoScanTest): if inputs['input_data'].shape[1] != weights['conv2d_weight'].shape[0]: return False + if attrs[0]['dilations'][0] != 1 or attrs[0]['dilations'][1] != 1: + return False + + ver = paddle_infer.get_trt_compile_version() + if ver[0] * 1000 + ver[1] * 100 + ver[2] * 10 < 7000: + return False + return True def sample_program_configs(self): @@ -175,9 +182,9 @@ class TrtConvertConv2dTransposeTest(TrtLayerAutoScanTest): self.trt_param.precision = paddle_infer.PrecisionType.Half yield self.create_inference_config(), generate_trt_nodes_num( attrs, False), (1e-5, 1e-3) - self.trt_param.precision = paddle_infer.PrecisionType.Int8 - yield self.create_inference_config(), generate_trt_nodes_num( - attrs, False), (1e-5, 1e-5) + # self.trt_param.precision = paddle_infer.PrecisionType.Int8 + # yield self.create_inference_config(), generate_trt_nodes_num( + # attrs, False), (1e-5, 1e-5) # for dynamic_shape generate_dynamic_shape(attrs) @@ -187,41 +194,18 @@ class TrtConvertConv2dTransposeTest(TrtLayerAutoScanTest): self.trt_param.precision = paddle_infer.PrecisionType.Half yield self.create_inference_config(), generate_trt_nodes_num( attrs, True), (1e-5, 1e-3) - self.trt_param.precision = paddle_infer.PrecisionType.Int8 - yield self.create_inference_config(), generate_trt_nodes_num( - attrs, True), (1e-5, 1e-5) + # self.trt_param.precision = paddle_infer.PrecisionType.Int8 + # yield self.create_inference_config(), generate_trt_nodes_num( + # attrs, True), (1e-5, 1e-5) def add_skip_trt_case(self): def teller1(program_config, predictor_config): - if program_config.ops[0].attrs[ - 'padding_algorithm'] == "SAME" or program_config.ops[ - 0].attrs['padding_algorithm'] == "VALID": - return True - return False - - self.add_skip_case( - teller1, SkipReasons.TRT_NOT_IMPLEMENTED, - "When padding_algorithm is 'SAME' or 'VALID', Trt dose not support. In this case, trt build error is caused by scale op." - ) - - def teller2(program_config, predictor_config): - if program_config.ops[0].attrs['dilations'][ - 0] != 1 or program_config.ops[0].attrs['dilations'][1] != 1: - return True - return False - - self.add_skip_case( - teller2, SkipReasons.TRT_NOT_IMPLEMENTED, - "When dilations's element is not equal 1, there are different behaviors between Trt and Paddle." - ) - - def teller3(program_config, predictor_config): if self.trt_param.precision == paddle_infer.PrecisionType.Int8: return True return False self.add_skip_case( - teller3, SkipReasons.TRT_NOT_IMPLEMENTED, + teller1, SkipReasons.TRT_NOT_IMPLEMENTED, "When precisionType is int8 without relu op, output is different between Trt and Paddle." ) diff --git a/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_deformable_conv.py b/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_deformable_conv.py index 9d29034d7fe18d069dd7bc3b4651a4c97d13976a..c692e92861bc6cc6bae2354e287c2554639af825 100644 --- a/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_deformable_conv.py +++ b/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_deformable_conv.py @@ -147,7 +147,7 @@ class TrtConvertDeformableConvTest(TrtLayerAutoScanTest): if len(attrs[0]['paddings']) == 4: return 1, 2 else: - return 1, 2 + return 1, 4 attrs = [ program_config.ops[i].attrs @@ -160,20 +160,8 @@ class TrtConvertDeformableConvTest(TrtLayerAutoScanTest): yield self.create_inference_config(), generate_trt_nodes_num( attrs, False), 1e-5 - def add_skip_trt_case(self): - def teller1(program_config, predictor_config): - if len(program_config.ops[0].attrs["strides"]) != 2: - return False - - return True - - self.add_skip_case( - teller1, SkipReasons.TRT_NOT_IMPLEMENTED, - "In deformable conv, length of Attr(strides) should be 2.") - def test(self): self.trt_param.workspace_size = 1 << 28 - self.add_skip_trt_case() self.run_test() diff --git a/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_depthwise_conv2d_transpose.py b/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_depthwise_conv2d_transpose.py index 66a007f64b69c01fe6bb197f634625a526c3a796..5f77e7de0df423228d97372e6ccc42dfe458cf9a 100644 --- a/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_depthwise_conv2d_transpose.py +++ b/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_depthwise_conv2d_transpose.py @@ -40,6 +40,13 @@ class TrtConvertDepthwiseConv2dTransposeTest(TrtLayerAutoScanTest): if inputs['input_data'].shape[1] != attrs[0]['groups']: return False + if attrs[0]['dilations'][0] != 1 or attrs[0]['dilations'][1] != 1: + return False + + ver = paddle_infer.get_trt_compile_version() + if ver[0] * 1000 + ver[1] * 100 + ver[2] * 10 < 7000: + return False + return True def sample_program_configs(self): @@ -139,9 +146,9 @@ class TrtConvertDepthwiseConv2dTransposeTest(TrtLayerAutoScanTest): self.trt_param.precision = paddle_infer.PrecisionType.Half yield self.create_inference_config(), generate_trt_nodes_num( attrs, False), (1e-5, 1e-3) - self.trt_param.precision = paddle_infer.PrecisionType.Int8 - yield self.create_inference_config(), generate_trt_nodes_num( - attrs, False), (1e-5, 1e-5) + # self.trt_param.precision = paddle_infer.PrecisionType.Int8 + # yield self.create_inference_config(), generate_trt_nodes_num( + # attrs, False), (1e-5, 1e-5) # for dynamic_shape generate_dynamic_shape(attrs) @@ -151,41 +158,18 @@ class TrtConvertDepthwiseConv2dTransposeTest(TrtLayerAutoScanTest): self.trt_param.precision = paddle_infer.PrecisionType.Half yield self.create_inference_config(), generate_trt_nodes_num( attrs, True), (1e-5, 1e-5) - self.trt_param.precision = paddle_infer.PrecisionType.Int8 - yield self.create_inference_config(), generate_trt_nodes_num( - attrs, True), (1e-5, 1e-5) + # self.trt_param.precision = paddle_infer.PrecisionType.Int8 + # yield self.create_inference_config(), generate_trt_nodes_num( + # attrs, True), (1e-5, 1e-5) def add_skip_trt_case(self): def teller1(program_config, predictor_config): - if program_config.ops[0].attrs[ - 'padding_algorithm'] == "SAME" or program_config.ops[ - 0].attrs['padding_algorithm'] == "VALID": - return True - return False - - self.add_skip_case( - teller1, SkipReasons.TRT_NOT_IMPLEMENTED, - "When padding_algorithm is 'SAME' or 'VALID', Trt dose not support. In this case, trt build error is caused by scale op." - ) - - def teller2(program_config, predictor_config): - if program_config.ops[0].attrs['dilations'][ - 0] != 1 or program_config.ops[0].attrs['dilations'][1] != 1: - return True - return False - - self.add_skip_case( - teller2, SkipReasons.TRT_NOT_IMPLEMENTED, - "When dilations's element is not equal 1, there are different behaviors between Trt and Paddle." - ) - - def teller3(program_config, predictor_config): if self.trt_param.precision == paddle_infer.PrecisionType.Int8: return True return False self.add_skip_case( - teller3, SkipReasons.TRT_NOT_IMPLEMENTED, + teller1, SkipReasons.TRT_NOT_IMPLEMENTED, "When precisionType is int8 without relu op, output is different between Trt and Paddle." )