From 62b382d15da3393bc4321ce034fc9ce04e4a8456 Mon Sep 17 00:00:00 2001 From: JZZ-NOTE Date: Tue, 18 Jan 2022 02:55:35 +0000 Subject: [PATCH] fix trt convert conv2d skip --- .../tests/unittests/ir/inference/test_trt_convert_conv2d.py | 6 ++++++ .../ir/inference/test_trt_convert_conv2d_fusion.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_conv2d.py b/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_conv2d.py index 0afa9d6ddda67..5f85debf4b27c 100644 --- a/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_conv2d.py +++ b/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_conv2d.py @@ -34,6 +34,12 @@ def is_program_valid(self, program_config: ProgramConfig) -> bool: 1] * attrs[0]['groups']: return False + ver = paddle_infer.get_trt_compile_version() + if ver[0] * 1000 + ver[1] * 100 + ver[0] * 10 < 7000: + if attrs[0]['padding_algorithm'] == 'SAME' and ( + attrs[0]['strides'][0] > 1 or attrs[0]['strides'][1] > 1): + return False + return True def sample_program_configs(self): diff --git a/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_conv2d_fusion.py b/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_conv2d_fusion.py index 3879755e02fb1..b1b5626c10eb9 100644 --- a/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_conv2d_fusion.py +++ b/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_conv2d_fusion.py @@ -37,6 +37,12 @@ def is_program_valid(self, program_config: ProgramConfig) -> bool: if attrs[0]['groups'] <= 1: return False + ver = paddle_infer.get_trt_compile_version() + if ver[0] * 1000 + ver[1] * 100 + ver[0] * 10 < 7000: + if attrs[0]['padding_algorithm'] == 'SAME' and ( + attrs[0]['strides'][0] > 1 or attrs[0]['strides'][1] > 1): + return False + return True def sample_program_configs(self):