Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions test/tensorrt/tensorrt_test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def __init__(self, methodName='runTest'):
self.max_shape = None
self.target_marker_op = ""
self.dynamic_shape_data = {}
self.enable_fp16 = None

def create_fake_program(self):
if self.python_api is None:
Expand Down Expand Up @@ -155,7 +154,7 @@ def prepare_feed(self):
new_list_args[sub_arg_name] = self.api_args[arg_name][i]
self.api_args[arg_name] = new_list_args

def check_trt_result(self, rtol=1e-5, atol=1e-5):
def check_trt_result(self, rtol=1e-5, atol=1e-5, precision_mode="fp32"):
paddle.framework.set_flags({"FLAGS_trt_min_group_size": 1})
with paddle.pir_utils.IrGuard():
self.prepare_feed()
Expand Down Expand Up @@ -255,7 +254,7 @@ def check_trt_result(self, rtol=1e-5, atol=1e-5):

# run TRTConverter(would lower group_op into tensorrt_engine_op)
trt_config = None
if self.enable_fp16:
if precision_mode == "fp16":
input = Input(
min_input_shape=self.min_shape,
optim_input_shape=self.min_shape,
Expand Down
6 changes: 4 additions & 2 deletions test/tensorrt/test_converter_conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ def setUp(self):
self.program_config = {"feed_list": ["x"]}
self.min_shape = {"x": [1, 3, 8, 8]}
self.max_shape = {"x": [10, 3, 8, 8]}
self.enable_fp16 = True

def test_trt_result(self):
def test_trt_result_fp16(self):
self.check_trt_result(precision_mode="fp16")

def test_trt_result_fp32(self):
self.check_trt_result()


Expand Down