未验证 提交 242d26d4 编写于 作者: F Frank Lin 提交者: GitHub

Set Input Type for TensorRT convert tests (#55823)

* set input type to fp16
上级 a127d7c8
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
import abc import abc
import enum import enum
import logging
import os import os
import shutil import shutil
import time import time
...@@ -35,9 +34,12 @@ from program_config import ( ...@@ -35,9 +34,12 @@ from program_config import (
import paddle import paddle
import paddle.inference as paddle_infer import paddle.inference as paddle_infer
from paddle.fluid.core import PassVersionChecker from paddle.fluid.core import PassVersionChecker
from paddle.static.log_helper import get_logger
LOGLEVEL = os.environ.get("PADDLE_TEST_LOGLEVEL", "INFO").upper() LOGLEVEL = os.environ.get("PADDLE_TEST_LOGLEVEL", "INFO").upper()
logging.basicConfig(level=LOGLEVEL, format="%(message)s") logging = get_logger(
__name__, LOGLEVEL, fmt='%(asctime)s-%(levelname)s: %(message)s'
)
settings.register_profile( settings.register_profile(
"ci", "ci",
...@@ -662,9 +664,6 @@ class TrtLayerAutoScanTest(AutoScanTest): ...@@ -662,9 +664,6 @@ class TrtLayerAutoScanTest(AutoScanTest):
) )
return config return config
def get_avalible_input_type(self) -> List[np.dtype]:
return [np.float32]
def assert_tensors_near( def assert_tensors_near(
self, self,
atol: float, atol: float,
...@@ -747,10 +746,13 @@ class TrtLayerAutoScanTest(AutoScanTest): ...@@ -747,10 +746,13 @@ class TrtLayerAutoScanTest(AutoScanTest):
if not skip_baseline: if not skip_baseline:
# baseline: gpu run, we only test float32 # baseline: gpu run, we only test float32
gpu_config = self.create_inference_config(use_trt=False) gpu_config = self.create_inference_config(use_trt=False)
prog_config = prog_config.set_input_type(
np.float16
).set_input_type(np.float32)
baseline_result = self.run_test_config( baseline_result = self.run_test_config(
model, model,
params, params,
prog_config.set_input_type(np.float32), prog_config,
gpu_config, gpu_config,
feed_data, feed_data,
) )
...@@ -761,82 +763,78 @@ class TrtLayerAutoScanTest(AutoScanTest): ...@@ -761,82 +763,78 @@ class TrtLayerAutoScanTest(AutoScanTest):
nodes_num, nodes_num,
threshold, threshold,
) in self.sample_predictor_configs(prog_config): ) in self.sample_predictor_configs(prog_config):
for input_type in self.get_avalible_input_type(): if os.path.exists(self.cache_dir):
prog_config = prog_config.set_input_type(input_type) shutil.rmtree(self.cache_dir)
if os.path.exists(self.cache_dir):
shutil.rmtree(self.cache_dir)
if isinstance(threshold, float): if isinstance(threshold, float):
atol = threshold atol = threshold
rtol = 1e-8 rtol = 1e-8
elif isinstance(threshold, list) or isinstance( elif isinstance(threshold, list) or isinstance(
threshold, tuple threshold, tuple
): ):
atol = threshold[0] atol = threshold[0]
rtol = threshold[1] rtol = threshold[1]
else: else:
raise NotImplementedError raise NotImplementedError
is_fp8 = ( is_fp8 = (
pred_config.tensorrt_precision_mode() pred_config.tensorrt_precision_mode()
== paddle_infer.PrecisionType.Int8 == paddle_infer.PrecisionType.Int8
) )
if (not is_fp8 and quant) or (is_fp8 and not quant): if (not is_fp8 and quant) or (is_fp8 and not quant):
continue continue
ignore_flag = False ignore_flag = False
for teller, reason, note in self.ignore_cases: for teller, reason, note in self.ignore_cases:
if teller(prog_config, pred_config): if teller(prog_config, pred_config):
ignore_flag = True ignore_flag = True
if reason == IgnoreReasons.TRT_NOT_IMPLEMENTED: if reason == IgnoreReasons.TRT_NOT_IMPLEMENTED:
self.ignore_log( self.ignore_log(
f"[TRT_NOT_IMPLEMENTED] {note} vs {self.inference_config_str(pred_config)}" f"[TRT_NOT_IMPLEMENTED] {note} vs {self.inference_config_str(pred_config)}"
)
elif reason == IgnoreReasons.TRT_NOT_SUPPORT:
self.ignore_log(
f"[TRT_NOT_SUPPORT] {note} vs {self.inference_config_str(pred_config)}"
)
else:
raise NotImplementedError
break
if ignore_flag:
continue
try:
pred_config_deserialize = paddle_infer.Config(
pred_config
)
trt_result = self.run_test_config(
model, params, prog_config, pred_config, feed_data
)
self.assert_tensors_near(
atol, rtol, trt_result, baseline_result
)
trt_engine_num, paddle_op_num = nodes_num
self.assert_op_size(trt_engine_num, paddle_op_num)
# deserialize test
if trt_engine_num > 0:
self.run_test_config(
model,
params,
prog_config,
pred_config_deserialize,
feed_data,
) )
elif reason == IgnoreReasons.TRT_NOT_SUPPORT:
self.ignore_log(
f"[TRT_NOT_SUPPORT] {note} vs {self.inference_config_str(pred_config)}"
)
else:
raise NotImplementedError
break
self.success_log(f"program_config: {prog_config}") if ignore_flag:
self.success_log( continue
f"predictor_config: {self.inference_config_str(pred_config)}"
) try:
except Exception as e: pred_config_deserialize = paddle_infer.Config(pred_config)
self.fail_log(f"program_config: {prog_config}") trt_result = self.run_test_config(
self.fail_log( model, params, prog_config, pred_config, feed_data
f"predictor_config: {self.inference_config_str(pred_config)}" )
self.assert_tensors_near(
atol, rtol, trt_result, baseline_result
)
trt_engine_num, paddle_op_num = nodes_num
self.assert_op_size(trt_engine_num, paddle_op_num)
# deserialize test
if trt_engine_num > 0:
self.run_test_config(
model,
params,
prog_config,
pred_config_deserialize,
feed_data,
) )
self.fail_log(f"\033[1;31m ERROR INFO: {e}\033[0m")
all_passes = False self.success_log(f"program_config: {prog_config}")
self.success_log(
f"predictor_config: {self.inference_config_str(pred_config)}"
)
except Exception as e:
self.fail_log(f"program_config: {prog_config}")
self.fail_log(
f"predictor_config: {self.inference_config_str(pred_config)}"
)
self.fail_log(f"\033[1;31m ERROR INFO: {e}\033[0m")
all_passes = False
self.assertTrue(all_passes) self.assertTrue(all_passes)
......
...@@ -67,7 +67,7 @@ class TensorConfig: ...@@ -67,7 +67,7 @@ class TensorConfig:
def __repr__(self): def __repr__(self):
return str({'shape': self.shape, 'lod': self.lod, 'dtype': self.dtype}) return str({'shape': self.shape, 'lod': self.lod, 'dtype': self.dtype})
def astype(self, type: np.dtype): def convert_type_inplace(self, type: np.dtype):
self.data = self.data.astype(type) self.data = self.data.astype(type)
self.dtype = self.data.dtype self.dtype = self.data.dtype
return self return self
...@@ -277,9 +277,9 @@ class ProgramConfig: ...@@ -277,9 +277,9 @@ class ProgramConfig:
def set_input_type(self, type: np.dtype): def set_input_type(self, type: np.dtype):
for inp in self.inputs.values(): for inp in self.inputs.values():
inp.astype(type) inp.convert_type_inplace(type)
for weight in self.weights.values(): for weight in self.weights.values():
weight.astype(type) weight.convert_type_inplace(type)
return self return self
def get_input_type(self) -> np.dtype: def get_input_type(self) -> np.dtype:
......
...@@ -178,10 +178,12 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest): ...@@ -178,10 +178,12 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -189,10 +191,12 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest): ...@@ -189,10 +191,12 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -133,10 +133,12 @@ class TrtConvertAffineChannelTest(TrtLayerAutoScanTest): ...@@ -133,10 +133,12 @@ class TrtConvertAffineChannelTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -144,10 +146,12 @@ class TrtConvertAffineChannelTest(TrtLayerAutoScanTest): ...@@ -144,10 +146,12 @@ class TrtConvertAffineChannelTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -107,10 +107,12 @@ class TrtConvertAnchorGeneratorTest(TrtLayerAutoScanTest): ...@@ -107,10 +107,12 @@ class TrtConvertAnchorGeneratorTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -118,10 +120,12 @@ class TrtConvertAnchorGeneratorTest(TrtLayerAutoScanTest): ...@@ -118,10 +120,12 @@ class TrtConvertAnchorGeneratorTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -118,10 +118,12 @@ class TrtConvertArgMaxTest(TrtLayerAutoScanTest): ...@@ -118,10 +118,12 @@ class TrtConvertArgMaxTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -129,10 +131,12 @@ class TrtConvertArgMaxTest(TrtLayerAutoScanTest): ...@@ -129,10 +131,12 @@ class TrtConvertArgMaxTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -118,10 +118,12 @@ class TrtConvertArgMinTest(TrtLayerAutoScanTest): ...@@ -118,10 +118,12 @@ class TrtConvertArgMinTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -129,10 +131,12 @@ class TrtConvertArgMinTest(TrtLayerAutoScanTest): ...@@ -129,10 +131,12 @@ class TrtConvertArgMinTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -133,10 +133,12 @@ class TrtConvertAssignTest(TrtLayerAutoScanTest): ...@@ -133,10 +133,12 @@ class TrtConvertAssignTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-2 ), 1e-2
...@@ -144,10 +146,12 @@ class TrtConvertAssignTest(TrtLayerAutoScanTest): ...@@ -144,10 +146,12 @@ class TrtConvertAssignTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-2 ), 1e-2
......
...@@ -232,10 +232,12 @@ class TrtConvertBatchNormTest(TrtLayerAutoScanTest): ...@@ -232,10 +232,12 @@ class TrtConvertBatchNormTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -243,10 +245,12 @@ class TrtConvertBatchNormTest(TrtLayerAutoScanTest): ...@@ -243,10 +245,12 @@ class TrtConvertBatchNormTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -120,10 +120,12 @@ class TrtConvertBilinearInterpV2Test(TrtLayerAutoScanTest): ...@@ -120,10 +120,12 @@ class TrtConvertBilinearInterpV2Test(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-2 ), 1e-2
...@@ -131,10 +133,12 @@ class TrtConvertBilinearInterpV2Test(TrtLayerAutoScanTest): ...@@ -131,10 +133,12 @@ class TrtConvertBilinearInterpV2Test(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-2 ), 1e-2
......
...@@ -133,10 +133,12 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest): ...@@ -133,10 +133,12 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
...@@ -144,10 +146,12 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest): ...@@ -144,10 +146,12 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
......
...@@ -98,10 +98,12 @@ class TrtConvertBmmTest_dynamic(TrtLayerAutoScanTest): ...@@ -98,10 +98,12 @@ class TrtConvertBmmTest_dynamic(TrtLayerAutoScanTest):
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -115,10 +117,12 @@ class TrtConvertBmmTest_dynamic(TrtLayerAutoScanTest): ...@@ -115,10 +117,12 @@ class TrtConvertBmmTest_dynamic(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), tol_fp32 ), tol_fp32
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), tol_half ), tol_half
......
...@@ -164,10 +164,12 @@ class TrtConvertCastTest(TrtLayerAutoScanTest): ...@@ -164,10 +164,12 @@ class TrtConvertCastTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-2 ), 1e-2
...@@ -175,10 +177,12 @@ class TrtConvertCastTest(TrtLayerAutoScanTest): ...@@ -175,10 +177,12 @@ class TrtConvertCastTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-2 ), 1e-2
......
...@@ -143,10 +143,12 @@ class TrtConvertClipTest(TrtLayerAutoScanTest): ...@@ -143,10 +143,12 @@ class TrtConvertClipTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -154,10 +156,12 @@ class TrtConvertClipTest(TrtLayerAutoScanTest): ...@@ -154,10 +156,12 @@ class TrtConvertClipTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -153,10 +153,12 @@ class TrtConvertLogicalTest(TrtLayerAutoScanTest): ...@@ -153,10 +153,12 @@ class TrtConvertLogicalTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -164,10 +166,12 @@ class TrtConvertLogicalTest(TrtLayerAutoScanTest): ...@@ -164,10 +166,12 @@ class TrtConvertLogicalTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -295,10 +299,12 @@ class TrtConvertCompareTest(TrtLayerAutoScanTest): ...@@ -295,10 +299,12 @@ class TrtConvertCompareTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -306,10 +312,12 @@ class TrtConvertCompareTest(TrtLayerAutoScanTest): ...@@ -306,10 +312,12 @@ class TrtConvertCompareTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -454,10 +462,12 @@ class TrtConvertLessEqualTest(TrtLayerAutoScanTest): ...@@ -454,10 +462,12 @@ class TrtConvertLessEqualTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -465,10 +475,12 @@ class TrtConvertLessEqualTest(TrtLayerAutoScanTest): ...@@ -465,10 +475,12 @@ class TrtConvertLessEqualTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -613,10 +625,12 @@ class TrtConvertGreaterEqualTest(TrtLayerAutoScanTest): ...@@ -613,10 +625,12 @@ class TrtConvertGreaterEqualTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -624,10 +638,12 @@ class TrtConvertGreaterEqualTest(TrtLayerAutoScanTest): ...@@ -624,10 +638,12 @@ class TrtConvertGreaterEqualTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -750,10 +766,12 @@ class TrtConvertCompareSkipTest(TrtLayerAutoScanTest): ...@@ -750,10 +766,12 @@ class TrtConvertCompareSkipTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -761,10 +779,12 @@ class TrtConvertCompareSkipTest(TrtLayerAutoScanTest): ...@@ -761,10 +779,12 @@ class TrtConvertCompareSkipTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -320,10 +320,12 @@ class TrtConvertConcatTest(TrtLayerAutoScanTest): ...@@ -320,10 +320,12 @@ class TrtConvertConcatTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -331,10 +333,12 @@ class TrtConvertConcatTest(TrtLayerAutoScanTest): ...@@ -331,10 +333,12 @@ class TrtConvertConcatTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -171,14 +171,17 @@ class TrtConvertConv2dTest(TrtLayerAutoScanTest): ...@@ -171,14 +171,17 @@ class TrtConvertConv2dTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
self.trt_param.precision = paddle_infer.PrecisionType.Int8 self.trt_param.precision = paddle_infer.PrecisionType.Int8
program_config.set_input_type(np.int8)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-2, 1e-2) ), (1e-2, 1e-2)
...@@ -186,14 +189,17 @@ class TrtConvertConv2dTest(TrtLayerAutoScanTest): ...@@ -186,14 +189,17 @@ class TrtConvertConv2dTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
self.trt_param.precision = paddle_infer.PrecisionType.Int8 self.trt_param.precision = paddle_infer.PrecisionType.Int8
program_config.set_input_type(np.int8)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-2, 1e-2) ), (1e-2, 1e-2)
...@@ -356,11 +362,13 @@ class TrtConvertConv2dNotPersistableTest(TrtLayerAutoScanTest): ...@@ -356,11 +362,13 @@ class TrtConvertConv2dNotPersistableTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-2, 1e-2) ), (1e-2, 1e-2)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-2, 1e-2) ), (1e-2, 1e-2)
......
...@@ -179,14 +179,17 @@ class TrtConvertConv2dFusionTest(TrtLayerAutoScanTest): ...@@ -179,14 +179,17 @@ class TrtConvertConv2dFusionTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
self.trt_param.precision = paddle_infer.PrecisionType.Int8 self.trt_param.precision = paddle_infer.PrecisionType.Int8
program_config.set_input_type(np.int8)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -194,14 +197,17 @@ class TrtConvertConv2dFusionTest(TrtLayerAutoScanTest): ...@@ -194,14 +197,17 @@ class TrtConvertConv2dFusionTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
self.trt_param.precision = paddle_infer.PrecisionType.Int8 self.trt_param.precision = paddle_infer.PrecisionType.Int8
program_config.set_input_type(np.int8)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -194,10 +194,12 @@ class TrtConvertConv2dTransposeTest(TrtLayerAutoScanTest): ...@@ -194,10 +194,12 @@ class TrtConvertConv2dTransposeTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -208,10 +210,12 @@ class TrtConvertConv2dTransposeTest(TrtLayerAutoScanTest): ...@@ -208,10 +210,12 @@ class TrtConvertConv2dTransposeTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -338,10 +342,12 @@ class TrtConvertConv2dTransposeTest2(TrtLayerAutoScanTest): ...@@ -338,10 +342,12 @@ class TrtConvertConv2dTransposeTest2(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-4 ), 1e-4
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e0, 1e-3) ), (1e0, 1e-3)
...@@ -349,10 +355,12 @@ class TrtConvertConv2dTransposeTest2(TrtLayerAutoScanTest): ...@@ -349,10 +355,12 @@ class TrtConvertConv2dTransposeTest2(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-4 ), 1e-4
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e0, 1e-3) ), (1e0, 1e-3)
......
...@@ -118,6 +118,7 @@ class TrtConvertConv3dTransposeTest(TrtLayerAutoScanTest): ...@@ -118,6 +118,7 @@ class TrtConvertConv3dTransposeTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -125,6 +126,7 @@ class TrtConvertConv3dTransposeTest(TrtLayerAutoScanTest): ...@@ -125,6 +126,7 @@ class TrtConvertConv3dTransposeTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -270,17 +270,21 @@ class TrtConvertCrossMultiHeadMatmulTest(TrtLayerAutoScanTest): ...@@ -270,17 +270,21 @@ class TrtConvertCrossMultiHeadMatmulTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
self.trt_param.workspace_size = 2013265920 self.trt_param.workspace_size = 2013265920
yield self.create_inference_config(), (1, 4), (1e-5, 1e-5) yield self.create_inference_config(), (1, 4), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 4), (1e-2, 1e-3) yield self.create_inference_config(), (1, 4), (1e-2, 1e-3)
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
self.trt_param.workspace_size = 2013265920 self.trt_param.workspace_size = 2013265920
yield self.create_inference_config(), (1, 3), (1e-5, 1e-4) yield self.create_inference_config(), (1, 3), (1e-5, 1e-4)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 3), (1e-2, 1e-2) yield self.create_inference_config(), (1, 3), (1e-2, 1e-2)
def add_skip_trt_case(self): def add_skip_trt_case(self):
......
...@@ -175,10 +175,12 @@ class TrtConvertCumsum(TrtLayerAutoScanTest): ...@@ -175,10 +175,12 @@ class TrtConvertCumsum(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape() generate_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-2 ), 1e-2
......
...@@ -219,11 +219,13 @@ class TrtConvertDeformableConvTest(TrtLayerAutoScanTest): ...@@ -219,11 +219,13 @@ class TrtConvertDeformableConvTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-5, 1e-5) ), (1e-5, 1e-5)
......
...@@ -151,13 +151,16 @@ class TrtConvertDepthwiseConv2dTest(TrtLayerAutoScanTest): ...@@ -151,13 +151,16 @@ class TrtConvertDepthwiseConv2dTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num(), 1e-5 yield self.create_inference_config(), generate_trt_nodes_num(), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num(), ( yield self.create_inference_config(), generate_trt_nodes_num(), (
1e-3, 1e-3,
1e-3, 1e-3,
) )
self.trt_param.precision = paddle_infer.PrecisionType.Int8 self.trt_param.precision = paddle_infer.PrecisionType.Int8
program_config.set_input_type(np.int8)
yield self.create_inference_config(), generate_trt_nodes_num(), ( yield self.create_inference_config(), generate_trt_nodes_num(), (
1e-3, 1e-3,
1e-3, 1e-3,
...@@ -166,13 +169,16 @@ class TrtConvertDepthwiseConv2dTest(TrtLayerAutoScanTest): ...@@ -166,13 +169,16 @@ class TrtConvertDepthwiseConv2dTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num(), 1e-5 yield self.create_inference_config(), generate_trt_nodes_num(), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num(), ( yield self.create_inference_config(), generate_trt_nodes_num(), (
1e-3, 1e-3,
1e-3, 1e-3,
) )
self.trt_param.precision = paddle_infer.PrecisionType.Int8 self.trt_param.precision = paddle_infer.PrecisionType.Int8
program_config.set_input_type(np.int8)
yield self.create_inference_config(), generate_trt_nodes_num(), ( yield self.create_inference_config(), generate_trt_nodes_num(), (
1e-3, 1e-3,
1e-3, 1e-3,
......
...@@ -154,10 +154,12 @@ class TrtConvertDepthwiseConv2dTransposeTest(TrtLayerAutoScanTest): ...@@ -154,10 +154,12 @@ class TrtConvertDepthwiseConv2dTransposeTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -168,10 +170,12 @@ class TrtConvertDepthwiseConv2dTransposeTest(TrtLayerAutoScanTest): ...@@ -168,10 +170,12 @@ class TrtConvertDepthwiseConv2dTransposeTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -137,10 +137,12 @@ class TrtConvertDropoutTest(TrtLayerAutoScanTest): ...@@ -137,10 +137,12 @@ class TrtConvertDropoutTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -148,10 +150,12 @@ class TrtConvertDropoutTest(TrtLayerAutoScanTest): ...@@ -148,10 +150,12 @@ class TrtConvertDropoutTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -146,10 +146,12 @@ class TrtConvertEinsumTest_SingleOperand(TrtLayerAutoScanTest): ...@@ -146,10 +146,12 @@ class TrtConvertEinsumTest_SingleOperand(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
...@@ -157,10 +159,12 @@ class TrtConvertEinsumTest_SingleOperand(TrtLayerAutoScanTest): ...@@ -157,10 +159,12 @@ class TrtConvertEinsumTest_SingleOperand(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
...@@ -326,10 +330,12 @@ class TrtConvertEinsumTest_DoubuleOperand_Vector_Matrix(TrtLayerAutoScanTest): ...@@ -326,10 +330,12 @@ class TrtConvertEinsumTest_DoubuleOperand_Vector_Matrix(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
...@@ -337,10 +343,12 @@ class TrtConvertEinsumTest_DoubuleOperand_Vector_Matrix(TrtLayerAutoScanTest): ...@@ -337,10 +343,12 @@ class TrtConvertEinsumTest_DoubuleOperand_Vector_Matrix(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
...@@ -456,10 +464,12 @@ class TrtConvertEinsumTest_DoubuleOperand_Matrix_Matrix(TrtLayerAutoScanTest): ...@@ -456,10 +464,12 @@ class TrtConvertEinsumTest_DoubuleOperand_Matrix_Matrix(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
...@@ -467,10 +477,12 @@ class TrtConvertEinsumTest_DoubuleOperand_Matrix_Matrix(TrtLayerAutoScanTest): ...@@ -467,10 +477,12 @@ class TrtConvertEinsumTest_DoubuleOperand_Matrix_Matrix(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
......
...@@ -139,10 +139,12 @@ class TrtConvertElementwiseTestOneInputSpecialCase0(TrtLayerAutoScanTest): ...@@ -139,10 +139,12 @@ class TrtConvertElementwiseTestOneInputSpecialCase0(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-5, 1e-5) ), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -150,10 +152,12 @@ class TrtConvertElementwiseTestOneInputSpecialCase0(TrtLayerAutoScanTest): ...@@ -150,10 +152,12 @@ class TrtConvertElementwiseTestOneInputSpecialCase0(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-5, 1e-5) ), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -270,10 +274,12 @@ class TrtConvertElementwiseTestOneInputSpecialCase1(TrtLayerAutoScanTest): ...@@ -270,10 +274,12 @@ class TrtConvertElementwiseTestOneInputSpecialCase1(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-5, 1e-5) ), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -281,10 +287,12 @@ class TrtConvertElementwiseTestOneInputSpecialCase1(TrtLayerAutoScanTest): ...@@ -281,10 +287,12 @@ class TrtConvertElementwiseTestOneInputSpecialCase1(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-5, 1e-5) ), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -431,10 +439,12 @@ class TrtConvertElementwiseTestOneInput(TrtLayerAutoScanTest): ...@@ -431,10 +439,12 @@ class TrtConvertElementwiseTestOneInput(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-5, 1e-5) ), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -442,10 +452,12 @@ class TrtConvertElementwiseTestOneInput(TrtLayerAutoScanTest): ...@@ -442,10 +452,12 @@ class TrtConvertElementwiseTestOneInput(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-5, 1e-5) ), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -599,10 +611,12 @@ class TrtConvertElementwiseTestTwoInputWithoutBroadcast(TrtLayerAutoScanTest): ...@@ -599,10 +611,12 @@ class TrtConvertElementwiseTestTwoInputWithoutBroadcast(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-5, 1e-5) ), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -610,8 +624,10 @@ class TrtConvertElementwiseTestTwoInputWithoutBroadcast(TrtLayerAutoScanTest): ...@@ -610,8 +624,10 @@ class TrtConvertElementwiseTestTwoInputWithoutBroadcast(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 3), (1e-5, 1e-5) yield self.create_inference_config(), (1, 3), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 3), (1e-3, 1e-3) yield self.create_inference_config(), (1, 3), (1e-3, 1e-3)
def add_skip_trt_case(self): def add_skip_trt_case(self):
...@@ -770,15 +786,19 @@ class TrtConvertElementwiseTestTwoInputWithBroadcast(TrtLayerAutoScanTest): ...@@ -770,15 +786,19 @@ class TrtConvertElementwiseTestTwoInputWithBroadcast(TrtLayerAutoScanTest):
clear_dynamic_shape() clear_dynamic_shape()
if self.shape1[0] == self.shape2[0]: if self.shape1[0] == self.shape2[0]:
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 3), (1e-5, 1e-5) yield self.create_inference_config(), (1, 3), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 3), (1e-3, 1e-3) yield self.create_inference_config(), (1, 3), (1e-3, 1e-3)
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 3), (1e-5, 1e-5) yield self.create_inference_config(), (1, 3), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 3), (1e-3, 1e-3) yield self.create_inference_config(), (1, 3), (1e-3, 1e-3)
def add_skip_trt_case(self): def add_skip_trt_case(self):
...@@ -921,15 +941,19 @@ class TrtConvertElementwiseTestOneInputCornerCase(TrtLayerAutoScanTest): ...@@ -921,15 +941,19 @@ class TrtConvertElementwiseTestOneInputCornerCase(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (0, 3), (1e-5, 1e-5) yield self.create_inference_config(), (0, 3), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (0, 3), (1e-3, 1e-3) yield self.create_inference_config(), (0, 3), (1e-3, 1e-3)
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 2), (1e-5, 1e-5) yield self.create_inference_config(), (1, 2), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 2), (1e-3, 1e-3) yield self.create_inference_config(), (1, 2), (1e-3, 1e-3)
def add_skip_trt_case(self): def add_skip_trt_case(self):
...@@ -1069,10 +1093,12 @@ class TrtConvertElementwiseTestTwoInputSkipCase(TrtLayerAutoScanTest): ...@@ -1069,10 +1093,12 @@ class TrtConvertElementwiseTestTwoInputSkipCase(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-5, 1e-5) ), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -1080,8 +1106,10 @@ class TrtConvertElementwiseTestTwoInputSkipCase(TrtLayerAutoScanTest): ...@@ -1080,8 +1106,10 @@ class TrtConvertElementwiseTestTwoInputSkipCase(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (0, 4), (1e-5, 1e-5) yield self.create_inference_config(), (0, 4), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (0, 4), (1e-3, 1e-3) yield self.create_inference_config(), (0, 4), (1e-3, 1e-3)
def add_skip_trt_case(self): def add_skip_trt_case(self):
...@@ -1187,10 +1215,12 @@ class TrtConvertPowOp(TrtLayerAutoScanTest): ...@@ -1187,10 +1215,12 @@ class TrtConvertPowOp(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-5, 1e-5) ), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -1198,10 +1228,12 @@ class TrtConvertPowOp(TrtLayerAutoScanTest): ...@@ -1198,10 +1228,12 @@ class TrtConvertPowOp(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-5, 1e-5) ), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -1347,10 +1379,12 @@ class TrtConvertElementwise0D(TrtLayerAutoScanTest): ...@@ -1347,10 +1379,12 @@ class TrtConvertElementwise0D(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-5, 1e-5) ), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -1358,10 +1392,12 @@ class TrtConvertElementwise0D(TrtLayerAutoScanTest): ...@@ -1358,10 +1392,12 @@ class TrtConvertElementwise0D(TrtLayerAutoScanTest):
# # for dynamic_shape # # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-5, 1e-5) ), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -162,10 +162,12 @@ class TrtConvertElementwiseaddTransposeTest(TrtLayerAutoScanTest): ...@@ -162,10 +162,12 @@ class TrtConvertElementwiseaddTransposeTest(TrtLayerAutoScanTest):
# just support dynamic_shape # just support dynamic_shape
generate_dynamic_shape(attrs, inputs) generate_dynamic_shape(attrs, inputs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), ( ), (
......
...@@ -293,15 +293,19 @@ class TrtConvertEmbEltwiseLayernormTest1(TrtLayerAutoScanTest): ...@@ -293,15 +293,19 @@ class TrtConvertEmbEltwiseLayernormTest1(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (0, 5), 1e-5 yield self.create_inference_config(), (0, 5), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (0, 5), 2e-2 yield self.create_inference_config(), (0, 5), 2e-2
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 4), 1e-5 yield self.create_inference_config(), (1, 4), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 4), 2e-2 yield self.create_inference_config(), (1, 4), 2e-2
def test(self): def test(self):
......
...@@ -157,10 +157,12 @@ class TrtConvertEqualOneInputCornerCase(TrtLayerAutoScanTest): ...@@ -157,10 +157,12 @@ class TrtConvertEqualOneInputCornerCase(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -168,10 +170,12 @@ class TrtConvertEqualOneInputCornerCase(TrtLayerAutoScanTest): ...@@ -168,10 +170,12 @@ class TrtConvertEqualOneInputCornerCase(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -154,10 +154,12 @@ class TrtConvertExpandASV2Test(TrtLayerAutoScanTest): ...@@ -154,10 +154,12 @@ class TrtConvertExpandASV2Test(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
...@@ -244,9 +246,11 @@ class TrtConvertExpandV2Test2(TrtLayerAutoScanTest): ...@@ -244,9 +246,11 @@ class TrtConvertExpandV2Test2(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape() generate_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
# fill_constant will be folded by constnt folding pass! # fill_constant will be folded by constnt folding pass!
yield self.create_inference_config(), (1, 2), 1e-5 yield self.create_inference_config(), (1, 2), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 2), 1e-3 yield self.create_inference_config(), (1, 2), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
......
...@@ -147,10 +147,12 @@ class TrtConvertExpandV2Test(TrtLayerAutoScanTest): ...@@ -147,10 +147,12 @@ class TrtConvertExpandV2Test(TrtLayerAutoScanTest):
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -158,10 +160,12 @@ class TrtConvertExpandV2Test(TrtLayerAutoScanTest): ...@@ -158,10 +160,12 @@ class TrtConvertExpandV2Test(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
...@@ -248,9 +252,11 @@ class TrtConvertExpandV2Test2(TrtLayerAutoScanTest): ...@@ -248,9 +252,11 @@ class TrtConvertExpandV2Test2(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape() generate_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
# fill_constant will be folded by constnt folding pass! # fill_constant will be folded by constnt folding pass!
yield self.create_inference_config(), (1, 2), 1e-5 yield self.create_inference_config(), (1, 2), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 2), 1e-3 yield self.create_inference_config(), (1, 2), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
...@@ -392,9 +398,11 @@ class TrtConvertExpandV2Test3(TrtLayerAutoScanTest): ...@@ -392,9 +398,11 @@ class TrtConvertExpandV2Test3(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape() generate_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
# fill_constant will be folded by constnt folding pass! # fill_constant will be folded by constnt folding pass!
yield self.create_inference_config(), (1, 2), 1e-5 yield self.create_inference_config(), (1, 2), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 2), 1e-3 yield self.create_inference_config(), (1, 2), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
......
...@@ -167,10 +167,12 @@ class TrtConvertExpandV2Test(TrtLayerAutoScanTest): ...@@ -167,10 +167,12 @@ class TrtConvertExpandV2Test(TrtLayerAutoScanTest):
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
...@@ -178,10 +180,12 @@ class TrtConvertExpandV2Test(TrtLayerAutoScanTest): ...@@ -178,10 +180,12 @@ class TrtConvertExpandV2Test(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
......
...@@ -142,10 +142,12 @@ class TrtConvertFillConstantTest(TrtLayerAutoScanTest): ...@@ -142,10 +142,12 @@ class TrtConvertFillConstantTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -265,17 +265,21 @@ class TrtConvertFlashMultiHeadMatmulTest(TrtLayerAutoScanTest): ...@@ -265,17 +265,21 @@ class TrtConvertFlashMultiHeadMatmulTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
self.trt_param.workspace_size = 2013265920 self.trt_param.workspace_size = 2013265920
yield self.create_inference_config(), (1, 2), (1e-5, 1e-5) yield self.create_inference_config(), (1, 2), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 2), (1e-3, 1e-3) yield self.create_inference_config(), (1, 2), (1e-3, 1e-3)
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
self.trt_param.workspace_size = 2013265920 self.trt_param.workspace_size = 2013265920
yield self.create_inference_config(), (1, 2), (1e-5, 1e-4) yield self.create_inference_config(), (1, 2), (1e-5, 1e-4)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 2), (1e-2, 1e-3) yield self.create_inference_config(), (1, 2), (1e-2, 1e-3)
def add_skip_trt_case(self): def add_skip_trt_case(self):
......
...@@ -101,10 +101,12 @@ class TrtConvertFlattenTest_dim_2(TrtLayerAutoScanTest): ...@@ -101,10 +101,12 @@ class TrtConvertFlattenTest_dim_2(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -112,10 +114,12 @@ class TrtConvertFlattenTest_dim_2(TrtLayerAutoScanTest): ...@@ -112,10 +114,12 @@ class TrtConvertFlattenTest_dim_2(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -202,10 +206,12 @@ class TrtConvertFlattenTest_dim_3(TrtLayerAutoScanTest): ...@@ -202,10 +206,12 @@ class TrtConvertFlattenTest_dim_3(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -213,10 +219,12 @@ class TrtConvertFlattenTest_dim_3(TrtLayerAutoScanTest): ...@@ -213,10 +219,12 @@ class TrtConvertFlattenTest_dim_3(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -303,10 +311,12 @@ class TrtConvertFlattenTest_dim_4(TrtLayerAutoScanTest): ...@@ -303,10 +311,12 @@ class TrtConvertFlattenTest_dim_4(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -314,10 +324,12 @@ class TrtConvertFlattenTest_dim_4(TrtLayerAutoScanTest): ...@@ -314,10 +324,12 @@ class TrtConvertFlattenTest_dim_4(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -404,10 +416,12 @@ class TrtConvertFlattenTest_dim_5(TrtLayerAutoScanTest): ...@@ -404,10 +416,12 @@ class TrtConvertFlattenTest_dim_5(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -415,10 +429,12 @@ class TrtConvertFlattenTest_dim_5(TrtLayerAutoScanTest): ...@@ -415,10 +429,12 @@ class TrtConvertFlattenTest_dim_5(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -130,10 +130,12 @@ class TrtConvertFlattenContiguousRangeTest(TrtLayerAutoScanTest): ...@@ -130,10 +130,12 @@ class TrtConvertFlattenContiguousRangeTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -141,10 +143,12 @@ class TrtConvertFlattenContiguousRangeTest(TrtLayerAutoScanTest): ...@@ -141,10 +143,12 @@ class TrtConvertFlattenContiguousRangeTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -124,10 +124,12 @@ class TrtConvertFlipTest(TrtLayerAutoScanTest): ...@@ -124,10 +124,12 @@ class TrtConvertFlipTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -121,10 +121,12 @@ class TrtConvertFusedTokenPruneTest(TrtLayerAutoScanTest): ...@@ -121,10 +121,12 @@ class TrtConvertFusedTokenPruneTest(TrtLayerAutoScanTest):
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-2, 1e-2) ), (1e-2, 1e-2)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-1, 1e-2) ), (1e-1, 1e-2)
......
...@@ -194,10 +194,12 @@ class TrtConvertGatherTest(TrtLayerAutoScanTest): ...@@ -194,10 +194,12 @@ class TrtConvertGatherTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
False False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
False False
), 1e-3 ), 1e-3
...@@ -205,8 +207,10 @@ class TrtConvertGatherTest(TrtLayerAutoScanTest): ...@@ -205,8 +207,10 @@ class TrtConvertGatherTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-5 yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-3 yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
......
...@@ -93,15 +93,19 @@ class TrtConvertGatherNdTest_dim_4_1(TrtLayerAutoScanTest): ...@@ -93,15 +93,19 @@ class TrtConvertGatherNdTest_dim_4_1(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (0, 4), 1e-5 yield self.create_inference_config(), (0, 4), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (0, 4), 1e-3 yield self.create_inference_config(), (0, 4), 1e-3
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 3), 1e-5 yield self.create_inference_config(), (1, 3), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 3), 1e-3 yield self.create_inference_config(), (1, 3), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
...@@ -183,15 +187,19 @@ class TrtConvertGatherNdTest_dim_4_1_2(TrtLayerAutoScanTest): ...@@ -183,15 +187,19 @@ class TrtConvertGatherNdTest_dim_4_1_2(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (0, 4), 1e-5 yield self.create_inference_config(), (0, 4), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (0, 4), 1e-3 yield self.create_inference_config(), (0, 4), 1e-3
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 3), 1e-5 yield self.create_inference_config(), (1, 3), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 3), 1e-3 yield self.create_inference_config(), (1, 3), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
...@@ -273,15 +281,19 @@ class TrtConvertGatherNdTest_dim_4_2(TrtLayerAutoScanTest): ...@@ -273,15 +281,19 @@ class TrtConvertGatherNdTest_dim_4_2(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (0, 4), 1e-5 yield self.create_inference_config(), (0, 4), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (0, 4), 1e-3 yield self.create_inference_config(), (0, 4), 1e-3
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 3), 1e-5 yield self.create_inference_config(), (1, 3), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 3), 1e-3 yield self.create_inference_config(), (1, 3), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
...@@ -363,15 +375,19 @@ class TrtConvertGatherNdTest_dim_4_3(TrtLayerAutoScanTest): ...@@ -363,15 +375,19 @@ class TrtConvertGatherNdTest_dim_4_3(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (0, 4), 1e-5 yield self.create_inference_config(), (0, 4), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (0, 4), 1e-3 yield self.create_inference_config(), (0, 4), 1e-3
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 3), 1e-5 yield self.create_inference_config(), (1, 3), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 3), 1e-3 yield self.create_inference_config(), (1, 3), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
...@@ -453,15 +469,19 @@ class TrtConvertGatherNdTest_dim_2_2(TrtLayerAutoScanTest): ...@@ -453,15 +469,19 @@ class TrtConvertGatherNdTest_dim_2_2(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (0, 4), 1e-5 yield self.create_inference_config(), (0, 4), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (0, 4), 1e-3 yield self.create_inference_config(), (0, 4), 1e-3
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 3), 1e-5 yield self.create_inference_config(), (1, 3), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 3), 1e-3 yield self.create_inference_config(), (1, 3), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
...@@ -545,15 +565,19 @@ class TrtConvertGatherNdTest_dim_3_3(TrtLayerAutoScanTest): ...@@ -545,15 +565,19 @@ class TrtConvertGatherNdTest_dim_3_3(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (0, 4), 1e-5 yield self.create_inference_config(), (0, 4), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (0, 4), 1e-3 yield self.create_inference_config(), (0, 4), 1e-3
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 3), 1e-5 yield self.create_inference_config(), (1, 3), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 3), 1e-3 yield self.create_inference_config(), (1, 3), 1e-3
def test(self): def test(self):
......
...@@ -127,10 +127,12 @@ class TrtConvertGeluTest(TrtLayerAutoScanTest): ...@@ -127,10 +127,12 @@ class TrtConvertGeluTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -138,10 +140,12 @@ class TrtConvertGeluTest(TrtLayerAutoScanTest): ...@@ -138,10 +140,12 @@ class TrtConvertGeluTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -138,8 +138,10 @@ class TrtConvertGridSampler(TrtLayerAutoScanTest): ...@@ -138,8 +138,10 @@ class TrtConvertGridSampler(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape() generate_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 3), 1e-5 yield self.create_inference_config(), (1, 3), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 3), 1e-3 yield self.create_inference_config(), (1, 3), 1e-3
def test(self): def test(self):
......
...@@ -125,11 +125,13 @@ class TrtConvertGroupNormTest(TrtLayerAutoScanTest): ...@@ -125,11 +125,13 @@ class TrtConvertGroupNormTest(TrtLayerAutoScanTest):
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.workspace_size = 2013265920 self.trt_param.workspace_size = 2013265920
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-2 ), 1e-2
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
...@@ -138,11 +140,13 @@ class TrtConvertGroupNormTest(TrtLayerAutoScanTest): ...@@ -138,11 +140,13 @@ class TrtConvertGroupNormTest(TrtLayerAutoScanTest):
self.trt_param.workspace_size = 2013265920 self.trt_param.workspace_size = 2013265920
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-2 ), 1e-2
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
......
...@@ -97,15 +97,19 @@ class TrtConvertHardSigmoidTest_dim_2(TrtLayerAutoScanTest): ...@@ -97,15 +97,19 @@ class TrtConvertHardSigmoidTest_dim_2(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 2), 1e-5 yield self.create_inference_config(), (1, 2), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 2), 1e-3 yield self.create_inference_config(), (1, 2), 1e-3
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 2), 1e-5 yield self.create_inference_config(), (1, 2), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 2), 1e-3 yield self.create_inference_config(), (1, 2), 1e-3
def test(self): def test(self):
......
...@@ -97,10 +97,12 @@ class TrtConvertHardSwishTest(TrtLayerAutoScanTest): ...@@ -97,10 +97,12 @@ class TrtConvertHardSwishTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -108,10 +110,12 @@ class TrtConvertHardSwishTest(TrtLayerAutoScanTest): ...@@ -108,10 +110,12 @@ class TrtConvertHardSwishTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -171,10 +171,12 @@ class TrtConvertIndexSelectTest(TrtLayerAutoScanTest): ...@@ -171,10 +171,12 @@ class TrtConvertIndexSelectTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
False False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
False False
), 1e-3 ), 1e-3
...@@ -182,8 +184,10 @@ class TrtConvertIndexSelectTest(TrtLayerAutoScanTest): ...@@ -182,8 +184,10 @@ class TrtConvertIndexSelectTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-5 yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-3 yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-3
def test(self): def test(self):
......
...@@ -145,10 +145,12 @@ class TrtConvertInstanceNormTest(TrtLayerAutoScanTest): ...@@ -145,10 +145,12 @@ class TrtConvertInstanceNormTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -156,10 +158,12 @@ class TrtConvertInstanceNormTest(TrtLayerAutoScanTest): ...@@ -156,10 +158,12 @@ class TrtConvertInstanceNormTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -82,15 +82,19 @@ class TrtConvertInverse(TrtLayerAutoScanTest): ...@@ -82,15 +82,19 @@ class TrtConvertInverse(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (0, 3), 1e-5 yield self.create_inference_config(), (0, 3), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (0, 3), 1e-3 yield self.create_inference_config(), (0, 3), 1e-3
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 2), 1e-5 yield self.create_inference_config(), (1, 2), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 2), 1e-3 yield self.create_inference_config(), (1, 2), 1e-3
def test(self): def test(self):
......
...@@ -125,10 +125,12 @@ class TrtConvertLayerNormTest(TrtLayerAutoScanTest): ...@@ -125,10 +125,12 @@ class TrtConvertLayerNormTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-2 ), 1e-2
...@@ -136,10 +138,12 @@ class TrtConvertLayerNormTest(TrtLayerAutoScanTest): ...@@ -136,10 +138,12 @@ class TrtConvertLayerNormTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-2 ), 1e-2
...@@ -249,10 +253,12 @@ class TrtConvertLayerNormTest_2(TrtLayerAutoScanTest): ...@@ -249,10 +253,12 @@ class TrtConvertLayerNormTest_2(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-2 ), 1e-2
...@@ -260,10 +266,12 @@ class TrtConvertLayerNormTest_2(TrtLayerAutoScanTest): ...@@ -260,10 +266,12 @@ class TrtConvertLayerNormTest_2(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-2 ), 1e-2
......
...@@ -103,14 +103,17 @@ class TrtConvertLeakyReluTest(TrtLayerAutoScanTest): ...@@ -103,14 +103,17 @@ class TrtConvertLeakyReluTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
self.trt_param.precision = paddle_infer.PrecisionType.Int8 self.trt_param.precision = paddle_infer.PrecisionType.Int8
program_config.set_input_type(np.int8)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -118,14 +121,17 @@ class TrtConvertLeakyReluTest(TrtLayerAutoScanTest): ...@@ -118,14 +121,17 @@ class TrtConvertLeakyReluTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
self.trt_param.precision = paddle_infer.PrecisionType.Int8 self.trt_param.precision = paddle_infer.PrecisionType.Int8
program_config.set_input_type(np.int8)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -138,10 +138,12 @@ class TrtConvertLookupTableV2Test(TrtLayerAutoScanTest): ...@@ -138,10 +138,12 @@ class TrtConvertLookupTableV2Test(TrtLayerAutoScanTest):
# for dynamic_shape mode # for dynamic_shape mode
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -128,10 +128,12 @@ class TrtConvertLookupTableV2Test(TrtLayerAutoScanTest): ...@@ -128,10 +128,12 @@ class TrtConvertLookupTableV2Test(TrtLayerAutoScanTest):
# for dynamic_shape mode # for dynamic_shape mode
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -101,8 +101,10 @@ class TrtConvertMatmulTest_static(TrtLayerAutoScanTest): ...@@ -101,8 +101,10 @@ class TrtConvertMatmulTest_static(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 3), 1e-5 yield self.create_inference_config(), (1, 3), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 3), 1e-3 yield self.create_inference_config(), (1, 3), 1e-3
def test(self): def test(self):
...@@ -192,8 +194,10 @@ class TrtConvertMatmulTest_dynamic(TrtLayerAutoScanTest): ...@@ -192,8 +194,10 @@ class TrtConvertMatmulTest_dynamic(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 3), 1e-5 yield self.create_inference_config(), (1, 3), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 3), 1e-3 yield self.create_inference_config(), (1, 3), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
......
...@@ -96,8 +96,10 @@ class TrtConvertMatmulTest_dynamic(TrtLayerAutoScanTest): ...@@ -96,8 +96,10 @@ class TrtConvertMatmulTest_dynamic(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 3), (tol_fp32, tol_fp32) yield self.create_inference_config(), (1, 3), (tol_fp32, tol_fp32)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 3), (tol_half, tol_half) yield self.create_inference_config(), (1, 3), (tol_half, tol_half)
def add_skip_trt_case(self): def add_skip_trt_case(self):
...@@ -182,8 +184,10 @@ class TrtConvertMatmulTest_dynamic2(TrtLayerAutoScanTest): ...@@ -182,8 +184,10 @@ class TrtConvertMatmulTest_dynamic2(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 3), (tol_fp32, tol_fp32) yield self.create_inference_config(), (1, 3), (tol_fp32, tol_fp32)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 3), (tol_half, tol_half) yield self.create_inference_config(), (1, 3), (tol_half, tol_half)
def add_skip_trt_case(self): def add_skip_trt_case(self):
...@@ -311,8 +315,10 @@ class TrtConvertMatmulTest_dynamic3(TrtLayerAutoScanTest): ...@@ -311,8 +315,10 @@ class TrtConvertMatmulTest_dynamic3(TrtLayerAutoScanTest):
generate_dynamic_shape() generate_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 3), 1e-5 yield self.create_inference_config(), (1, 3), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 3), 1e-3 yield self.create_inference_config(), (1, 3), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
......
...@@ -139,10 +139,12 @@ class TrtConvertMishTest(TrtLayerAutoScanTest): ...@@ -139,10 +139,12 @@ class TrtConvertMishTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -150,10 +152,12 @@ class TrtConvertMishTest(TrtLayerAutoScanTest): ...@@ -150,10 +152,12 @@ class TrtConvertMishTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -160,10 +160,12 @@ class TrtConvertMulticlassNMSTest(TrtLayerAutoScanTest): ...@@ -160,10 +160,12 @@ class TrtConvertMulticlassNMSTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-2 ), 1e-2
...@@ -171,6 +173,7 @@ class TrtConvertMulticlassNMSTest(TrtLayerAutoScanTest): ...@@ -171,6 +173,7 @@ class TrtConvertMulticlassNMSTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
......
...@@ -167,10 +167,12 @@ class TrtConvertMulticlassNMS3Test(TrtLayerAutoScanTest): ...@@ -167,10 +167,12 @@ class TrtConvertMulticlassNMS3Test(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-2 ), 1e-2
...@@ -178,6 +180,7 @@ class TrtConvertMulticlassNMS3Test(TrtLayerAutoScanTest): ...@@ -178,6 +180,7 @@ class TrtConvertMulticlassNMS3Test(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
......
...@@ -385,9 +385,11 @@ class TrtConvertMultiHeadMatmulTest(TrtLayerAutoScanTest): ...@@ -385,9 +385,11 @@ class TrtConvertMultiHeadMatmulTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
self.trt_param.workspace_size = 2013265920 self.trt_param.workspace_size = 2013265920
yield self.create_inference_config(), (1, 3), (1e-5, 1e-5) yield self.create_inference_config(), (1, 3), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 3), (1e-2, 1e-2) yield self.create_inference_config(), (1, 3), (1e-2, 1e-2)
def test(self): def test(self):
...@@ -983,16 +985,19 @@ class TrtConvertVitToMultiHeadMatmulTest(TrtLayerAutoScanTest): ...@@ -983,16 +985,19 @@ class TrtConvertVitToMultiHeadMatmulTest(TrtLayerAutoScanTest):
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.workspace_size = 2013265920 self.trt_param.workspace_size = 2013265920
self.trt_param.precision = paddle_infer.PrecisionType.Int8 self.trt_param.precision = paddle_infer.PrecisionType.Int8
program_config.set_input_type(np.int8)
yield self.create_inference_config(), generate_trt_nodes_num(), ( yield self.create_inference_config(), generate_trt_nodes_num(), (
1e-3, 1e-3,
1e-3, 1e-3,
) )
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num(), ( yield self.create_inference_config(), generate_trt_nodes_num(), (
1e-3, 1e-3,
2e-2, 2e-2,
) )
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num(), ( yield self.create_inference_config(), generate_trt_nodes_num(), (
1e-5, 1e-5,
1e-5, 1e-5,
...@@ -1364,9 +1369,11 @@ class TrtConvertMultiHeadMatmulTest_biasqk_seqseq(TrtLayerAutoScanTest): ...@@ -1364,9 +1369,11 @@ class TrtConvertMultiHeadMatmulTest_biasqk_seqseq(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
self.trt_param.workspace_size = 2013265920 self.trt_param.workspace_size = 2013265920
yield self.create_inference_config(), (1, 3), (1e-5, 1e-5) yield self.create_inference_config(), (1, 3), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 3), (1e-2, 1e-2) yield self.create_inference_config(), (1, 3), (1e-2, 1e-2)
def test(self): def test(self):
......
...@@ -540,9 +540,11 @@ class TrtConvertMultiHeadMatmulRoformerTest(TrtLayerAutoScanTest): ...@@ -540,9 +540,11 @@ class TrtConvertMultiHeadMatmulRoformerTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
self.trt_param.workspace_size = 2013265920 self.trt_param.workspace_size = 2013265920
yield self.create_inference_config(), (1, 5), (1e-3, 1e-3) yield self.create_inference_config(), (1, 5), (1e-3, 1e-3)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 5), (1e-3, 1e-3) yield self.create_inference_config(), (1, 5), (1e-3, 1e-3)
def test(self): def test(self):
......
...@@ -113,10 +113,12 @@ class TrtConvertNearestInterpTest(TrtLayerAutoScanTest): ...@@ -113,10 +113,12 @@ class TrtConvertNearestInterpTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-2 ), 1e-2
...@@ -124,10 +126,12 @@ class TrtConvertNearestInterpTest(TrtLayerAutoScanTest): ...@@ -124,10 +126,12 @@ class TrtConvertNearestInterpTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-2 ), 1e-2
......
...@@ -83,10 +83,12 @@ class TrtConvertNearestInterpV2Test(TrtLayerAutoScanTest): ...@@ -83,10 +83,12 @@ class TrtConvertNearestInterpV2Test(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-2 ), 1e-2
...@@ -94,10 +96,12 @@ class TrtConvertNearestInterpV2Test(TrtLayerAutoScanTest): ...@@ -94,10 +96,12 @@ class TrtConvertNearestInterpV2Test(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-2 ), 1e-2
...@@ -174,10 +178,12 @@ class TrtConvertNearestInterpV2ShapeTensorTest(TrtLayerAutoScanTest): ...@@ -174,10 +178,12 @@ class TrtConvertNearestInterpV2ShapeTensorTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-2 ), 1e-2
...@@ -185,10 +191,12 @@ class TrtConvertNearestInterpV2ShapeTensorTest(TrtLayerAutoScanTest): ...@@ -185,10 +191,12 @@ class TrtConvertNearestInterpV2ShapeTensorTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-2 ), 1e-2
......
...@@ -141,10 +141,12 @@ class TrtConvertOneHotTest(TrtLayerAutoScanTest): ...@@ -141,10 +141,12 @@ class TrtConvertOneHotTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
...@@ -152,10 +154,12 @@ class TrtConvertOneHotTest(TrtLayerAutoScanTest): ...@@ -152,10 +154,12 @@ class TrtConvertOneHotTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
......
...@@ -118,10 +118,12 @@ class TrtConvertPNormTest(TrtLayerAutoScanTest): ...@@ -118,10 +118,12 @@ class TrtConvertPNormTest(TrtLayerAutoScanTest):
# for dynamic_shape mode # for dynamic_shape mode
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -104,10 +104,12 @@ class TrtConvertPadTest(TrtLayerAutoScanTest): ...@@ -104,10 +104,12 @@ class TrtConvertPadTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-2 ), 1e-2
...@@ -115,10 +117,12 @@ class TrtConvertPadTest(TrtLayerAutoScanTest): ...@@ -115,10 +117,12 @@ class TrtConvertPadTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-2 ), 1e-2
......
...@@ -120,10 +120,12 @@ class TrtConvertPad3dTensorPadding(TrtLayerAutoScanTest): ...@@ -120,10 +120,12 @@ class TrtConvertPad3dTensorPadding(TrtLayerAutoScanTest):
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -131,10 +133,12 @@ class TrtConvertPad3dTensorPadding(TrtLayerAutoScanTest): ...@@ -131,10 +133,12 @@ class TrtConvertPad3dTensorPadding(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
...@@ -230,10 +234,12 @@ class TrtConvertPad3dListPadding(TrtLayerAutoScanTest): ...@@ -230,10 +234,12 @@ class TrtConvertPad3dListPadding(TrtLayerAutoScanTest):
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -241,10 +247,12 @@ class TrtConvertPad3dListPadding(TrtLayerAutoScanTest): ...@@ -241,10 +247,12 @@ class TrtConvertPad3dListPadding(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -153,10 +153,12 @@ class TrtConvertPool2dTest(TrtLayerAutoScanTest): ...@@ -153,10 +153,12 @@ class TrtConvertPool2dTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -164,10 +166,12 @@ class TrtConvertPool2dTest(TrtLayerAutoScanTest): ...@@ -164,10 +166,12 @@ class TrtConvertPool2dTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -169,10 +169,12 @@ class TrtConvertSkipLayernormTest(TrtLayerAutoScanTest): ...@@ -169,10 +169,12 @@ class TrtConvertSkipLayernormTest(TrtLayerAutoScanTest):
# for static_shape, fall back to fluid fused op # for static_shape, fall back to fluid fused op
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-2 # atol=1e-2 while rtol is 1e-8 ), 1e-2 # atol=1e-2 while rtol is 1e-8
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-2 # atol=1e-2 while rtol is 1e-8 ), 1e-2 # atol=1e-2 while rtol is 1e-8
...@@ -180,10 +182,12 @@ class TrtConvertSkipLayernormTest(TrtLayerAutoScanTest): ...@@ -180,10 +182,12 @@ class TrtConvertSkipLayernormTest(TrtLayerAutoScanTest):
# just support dynamic_shape # just support dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-2 # atol=1e-2 while rtol is 1e-8 ), 1e-2 # atol=1e-2 while rtol is 1e-8
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-2 # atol=1e-2 while rtol is 1e-8 ), 1e-2 # atol=1e-2 while rtol is 1e-8
......
...@@ -158,10 +158,12 @@ class TrtConvertSkipLayernormTest(TrtLayerAutoScanTest): ...@@ -158,10 +158,12 @@ class TrtConvertSkipLayernormTest(TrtLayerAutoScanTest):
# for static_shape, fall back to fluid fused op # for static_shape, fall back to fluid fused op
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-2 # atol=1e-2 while rtol is 1e-8 ), 1e-2 # atol=1e-2 while rtol is 1e-8
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-2 # atol=1e-2 while rtol is 1e-8 ), 1e-2 # atol=1e-2 while rtol is 1e-8
...@@ -169,10 +171,12 @@ class TrtConvertSkipLayernormTest(TrtLayerAutoScanTest): ...@@ -169,10 +171,12 @@ class TrtConvertSkipLayernormTest(TrtLayerAutoScanTest):
# just support dynamic_shape # just support dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-2 # atol=1e-2 while rtol is 1e-8 ), 1e-2 # atol=1e-2 while rtol is 1e-8
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-2 # atol=1e-2 while rtol is 1e-8 ), 1e-2 # atol=1e-2 while rtol is 1e-8
......
...@@ -205,10 +205,12 @@ class TrtConvertPreluTest(TrtLayerAutoScanTest): ...@@ -205,10 +205,12 @@ class TrtConvertPreluTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -216,10 +218,12 @@ class TrtConvertPreluTest(TrtLayerAutoScanTest): ...@@ -216,10 +218,12 @@ class TrtConvertPreluTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -329,17 +329,21 @@ class TrtConvertQkAttentionTest(TrtLayerAutoScanTest): ...@@ -329,17 +329,21 @@ class TrtConvertQkAttentionTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
self.trt_param.workspace_size = 2013265920 self.trt_param.workspace_size = 2013265920
yield self.create_inference_config(), (1, 3), (1e-5, 1e-5) yield self.create_inference_config(), (1, 3), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 3), (1e-3, 1e-3) yield self.create_inference_config(), (1, 3), (1e-3, 1e-3)
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
self.trt_param.workspace_size = 2013265920 self.trt_param.workspace_size = 2013265920
yield self.create_inference_config(), (1, 3), (1e-5, 1e-4) yield self.create_inference_config(), (1, 3), (1e-5, 1e-4)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 3), (1e-2, 1e-3) yield self.create_inference_config(), (1, 3), (1e-2, 1e-3)
def add_skip_trt_case(self): def add_skip_trt_case(self):
......
...@@ -130,10 +130,12 @@ class TrtConvertRangeDynamicTest(TrtLayerAutoScanTest): ...@@ -130,10 +130,12 @@ class TrtConvertRangeDynamicTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-2 ), 1e-2
...@@ -214,10 +216,12 @@ class TrtConvertRangeStaticTest(TrtLayerAutoScanTest): ...@@ -214,10 +216,12 @@ class TrtConvertRangeStaticTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-2 ), 1e-2
......
...@@ -164,10 +164,12 @@ class TrtConvertReduceTest(TrtLayerAutoScanTest): ...@@ -164,10 +164,12 @@ class TrtConvertReduceTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-5, 1e-5) ), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -175,10 +177,12 @@ class TrtConvertReduceTest(TrtLayerAutoScanTest): ...@@ -175,10 +177,12 @@ class TrtConvertReduceTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-5, 1e-5) ), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -172,10 +172,12 @@ class TrtConvertReshapeTest(TrtLayerAutoScanTest): ...@@ -172,10 +172,12 @@ class TrtConvertReshapeTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -183,10 +185,12 @@ class TrtConvertReshapeTest(TrtLayerAutoScanTest): ...@@ -183,10 +185,12 @@ class TrtConvertReshapeTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
...@@ -308,8 +312,10 @@ class TrtConvertReshapeTest2(TrtLayerAutoScanTest): ...@@ -308,8 +312,10 @@ class TrtConvertReshapeTest2(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape() generate_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 2), 1e-5 yield self.create_inference_config(), (1, 2), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 2), 1e-3 yield self.create_inference_config(), (1, 2), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
...@@ -419,8 +425,10 @@ class TrtConvertReshapeTest3(TrtLayerAutoScanTest): ...@@ -419,8 +425,10 @@ class TrtConvertReshapeTest3(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape() generate_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 2), 1e-5 yield self.create_inference_config(), (1, 2), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 2), 1e-3 yield self.create_inference_config(), (1, 2), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
...@@ -509,10 +517,12 @@ class TrtConvertReshapeZeroDimsTest(TrtLayerAutoScanTest): ...@@ -509,10 +517,12 @@ class TrtConvertReshapeZeroDimsTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -264,10 +264,12 @@ class TrtConvertSliceTest(TrtLayerAutoScanTest): ...@@ -264,10 +264,12 @@ class TrtConvertSliceTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), tol_fp32 ), tol_fp32
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), tol_half ), tol_half
......
...@@ -190,10 +190,12 @@ class TrtConvertRoiAlignTest(TrtLayerAutoScanTest): ...@@ -190,10 +190,12 @@ class TrtConvertRoiAlignTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -201,10 +203,12 @@ class TrtConvertRoiAlignTest(TrtLayerAutoScanTest): ...@@ -201,10 +203,12 @@ class TrtConvertRoiAlignTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -107,10 +107,12 @@ class TrtConvertRollTest(TrtLayerAutoScanTest): ...@@ -107,10 +107,12 @@ class TrtConvertRollTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -118,10 +120,12 @@ class TrtConvertRollTest(TrtLayerAutoScanTest): ...@@ -118,10 +120,12 @@ class TrtConvertRollTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -165,10 +165,12 @@ class TrtConvertScaleTest(TrtLayerAutoScanTest): ...@@ -165,10 +165,12 @@ class TrtConvertScaleTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -176,10 +178,12 @@ class TrtConvertScaleTest(TrtLayerAutoScanTest): ...@@ -176,10 +178,12 @@ class TrtConvertScaleTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -102,15 +102,19 @@ class TrtConvertScatterNd(TrtLayerAutoScanTest): ...@@ -102,15 +102,19 @@ class TrtConvertScatterNd(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (0, 5), 1e-5 yield self.create_inference_config(), (0, 5), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (0, 5), 1e-3 yield self.create_inference_config(), (0, 5), 1e-3
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 4), 1e-5 yield self.create_inference_config(), (1, 4), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 4), 1e-3 yield self.create_inference_config(), (1, 4), 1e-3
def test(self): def test(self):
......
...@@ -154,11 +154,13 @@ class TrtConvertSetValue(TrtLayerAutoScanTest): ...@@ -154,11 +154,13 @@ class TrtConvertSetValue(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
self.trt_param.workspace_size = 2013265920 self.trt_param.workspace_size = 2013265920
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-5, 1e-4) ), (1e-5, 1e-4)
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -99,10 +99,12 @@ class TrtConvertSumTest(TrtLayerAutoScanTest): ...@@ -99,10 +99,12 @@ class TrtConvertSumTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
False False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
False False
), 1e-3 ), 1e-3
...@@ -110,8 +112,10 @@ class TrtConvertSumTest(TrtLayerAutoScanTest): ...@@ -110,8 +112,10 @@ class TrtConvertSumTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape() generate_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-5 yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-3 yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-3
def test(self): def test(self):
......
...@@ -92,10 +92,12 @@ class TrtConvertShuffleChannelTest(TrtLayerAutoScanTest): ...@@ -92,10 +92,12 @@ class TrtConvertShuffleChannelTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -103,10 +105,12 @@ class TrtConvertShuffleChannelTest(TrtLayerAutoScanTest): ...@@ -103,10 +105,12 @@ class TrtConvertShuffleChannelTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -131,10 +131,12 @@ class TrtConvertSliceTest(TrtLayerAutoScanTest): ...@@ -131,10 +131,12 @@ class TrtConvertSliceTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -142,10 +144,12 @@ class TrtConvertSliceTest(TrtLayerAutoScanTest): ...@@ -142,10 +144,12 @@ class TrtConvertSliceTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -135,10 +135,12 @@ class TrtConvertSoftmaxTest(TrtLayerAutoScanTest): ...@@ -135,10 +135,12 @@ class TrtConvertSoftmaxTest(TrtLayerAutoScanTest):
pass pass
else: else:
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -146,10 +148,12 @@ class TrtConvertSoftmaxTest(TrtLayerAutoScanTest): ...@@ -146,10 +148,12 @@ class TrtConvertSoftmaxTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -250,10 +250,12 @@ class TrtConvertSplitTest(TrtLayerAutoScanTest): ...@@ -250,10 +250,12 @@ class TrtConvertSplitTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -261,10 +263,12 @@ class TrtConvertSplitTest(TrtLayerAutoScanTest): ...@@ -261,10 +263,12 @@ class TrtConvertSplitTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
...@@ -400,10 +404,12 @@ class TrtConvertSplitTest2(TrtLayerAutoScanTest): ...@@ -400,10 +404,12 @@ class TrtConvertSplitTest2(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -117,10 +117,12 @@ class TrtConvertSquareTest(TrtLayerAutoScanTest): ...@@ -117,10 +117,12 @@ class TrtConvertSquareTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -128,10 +130,12 @@ class TrtConvertSquareTest(TrtLayerAutoScanTest): ...@@ -128,10 +130,12 @@ class TrtConvertSquareTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -117,10 +117,12 @@ class TrtConvertSplitTest(TrtLayerAutoScanTest): ...@@ -117,10 +117,12 @@ class TrtConvertSplitTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -128,10 +130,12 @@ class TrtConvertSplitTest(TrtLayerAutoScanTest): ...@@ -128,10 +130,12 @@ class TrtConvertSplitTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -218,10 +218,12 @@ class TrtConvertStackTest(TrtLayerAutoScanTest): ...@@ -218,10 +218,12 @@ class TrtConvertStackTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -229,10 +231,12 @@ class TrtConvertStackTest(TrtLayerAutoScanTest): ...@@ -229,10 +231,12 @@ class TrtConvertStackTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -122,6 +122,7 @@ class TrtConvertStridedSliceTest(TrtLayerAutoScanTest): ...@@ -122,6 +122,7 @@ class TrtConvertStridedSliceTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
...@@ -129,6 +130,7 @@ class TrtConvertStridedSliceTest(TrtLayerAutoScanTest): ...@@ -129,6 +130,7 @@ class TrtConvertStridedSliceTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
...@@ -217,11 +219,13 @@ class TrtConvertStridedSliceTest2(TrtLayerAutoScanTest): ...@@ -217,11 +219,13 @@ class TrtConvertStridedSliceTest2(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 2), 1e-5 yield self.create_inference_config(), (1, 2), 1e-5
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape() generate_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 2), 1e-5 yield self.create_inference_config(), (1, 2), 1e-5
def test(self): def test(self):
......
...@@ -193,10 +193,12 @@ class TrtConvertSumTest(TrtLayerAutoScanTest): ...@@ -193,10 +193,12 @@ class TrtConvertSumTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
False False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
False False
), 1e-3 ), 1e-3
...@@ -204,8 +206,10 @@ class TrtConvertSumTest(TrtLayerAutoScanTest): ...@@ -204,8 +206,10 @@ class TrtConvertSumTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape() generate_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-5 yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-3 yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-3
def test(self): def test(self):
...@@ -311,10 +315,12 @@ class TrtConvertSumTest1(TrtLayerAutoScanTest): ...@@ -311,10 +315,12 @@ class TrtConvertSumTest1(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
False False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
False False
), 1e-3 ), 1e-3
...@@ -322,8 +328,10 @@ class TrtConvertSumTest1(TrtLayerAutoScanTest): ...@@ -322,8 +328,10 @@ class TrtConvertSumTest1(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape() generate_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-5 yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-3 yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-3
def test(self): def test(self):
......
...@@ -121,10 +121,12 @@ class TrtConvertSwishTest(TrtLayerAutoScanTest): ...@@ -121,10 +121,12 @@ class TrtConvertSwishTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -132,10 +134,12 @@ class TrtConvertSwishTest(TrtLayerAutoScanTest): ...@@ -132,10 +134,12 @@ class TrtConvertSwishTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -160,10 +160,12 @@ class TrtConvertTakeAlongAxisTest(TrtLayerAutoScanTest): ...@@ -160,10 +160,12 @@ class TrtConvertTakeAlongAxisTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
False False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
False False
), 1e-5 ), 1e-5
...@@ -171,8 +173,10 @@ class TrtConvertTakeAlongAxisTest(TrtLayerAutoScanTest): ...@@ -171,8 +173,10 @@ class TrtConvertTakeAlongAxisTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-5 yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-3 yield self.create_inference_config(), generate_trt_nodes_num(True), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
......
...@@ -108,10 +108,12 @@ class TrtConvertTemporalShiftTest(TrtLayerAutoScanTest): ...@@ -108,10 +108,12 @@ class TrtConvertTemporalShiftTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -119,10 +121,12 @@ class TrtConvertTemporalShiftTest(TrtLayerAutoScanTest): ...@@ -119,10 +121,12 @@ class TrtConvertTemporalShiftTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -93,10 +93,12 @@ class TrtConvertTileTest(TrtLayerAutoScanTest): ...@@ -93,10 +93,12 @@ class TrtConvertTileTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -104,10 +106,12 @@ class TrtConvertTileTest(TrtLayerAutoScanTest): ...@@ -104,10 +106,12 @@ class TrtConvertTileTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
...@@ -184,10 +188,12 @@ class TrtConvertTileTest2(TrtLayerAutoScanTest): ...@@ -184,10 +188,12 @@ class TrtConvertTileTest2(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
...@@ -283,10 +289,12 @@ class TrtConvertTileTest3(TrtLayerAutoScanTest): ...@@ -283,10 +289,12 @@ class TrtConvertTileTest3(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -118,10 +118,12 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest): ...@@ -118,10 +118,12 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -129,10 +131,12 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest): ...@@ -129,10 +131,12 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -147,10 +147,12 @@ class TrtConvertTopKV2Test(TrtLayerAutoScanTest): ...@@ -147,10 +147,12 @@ class TrtConvertTopKV2Test(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -158,10 +160,12 @@ class TrtConvertTopKV2Test(TrtLayerAutoScanTest): ...@@ -158,10 +160,12 @@ class TrtConvertTopKV2Test(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -226,10 +226,12 @@ class TrtConvertTransLayernormTest(TrtLayerAutoScanTest): ...@@ -226,10 +226,12 @@ class TrtConvertTransLayernormTest(TrtLayerAutoScanTest):
# just support dynamic_shape # just support dynamic_shape
generate_dynamic_shape(attrs, inputs) generate_dynamic_shape(attrs, inputs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), ( ), (
......
...@@ -139,10 +139,12 @@ class TrtConvertTransposeTest(TrtLayerAutoScanTest): ...@@ -139,10 +139,12 @@ class TrtConvertTransposeTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -150,10 +152,12 @@ class TrtConvertTransposeTest(TrtLayerAutoScanTest): ...@@ -150,10 +152,12 @@ class TrtConvertTransposeTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -208,10 +208,12 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest): ...@@ -208,10 +208,12 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-4 ), 1e-4
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -219,10 +221,12 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest): ...@@ -219,10 +221,12 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-4 ), 1e-4
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
...@@ -342,10 +346,12 @@ class TrtConvertLogicalNotTest(TrtLayerAutoScanTest): ...@@ -342,10 +346,12 @@ class TrtConvertLogicalNotTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), (1e-3, 1e-3) ), (1e-3, 1e-3)
...@@ -353,10 +359,12 @@ class TrtConvertLogicalNotTest(TrtLayerAutoScanTest): ...@@ -353,10 +359,12 @@ class TrtConvertLogicalNotTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), (1e-3, 1e-3) ), (1e-3, 1e-3)
......
...@@ -106,10 +106,12 @@ class TrtConvertUnbind(TrtLayerAutoScanTest): ...@@ -106,10 +106,12 @@ class TrtConvertUnbind(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -87,15 +87,19 @@ class TrtConvertUnfold(TrtLayerAutoScanTest): ...@@ -87,15 +87,19 @@ class TrtConvertUnfold(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (0, 3), 1e-5 yield self.create_inference_config(), (0, 3), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (0, 3), 1e-3 yield self.create_inference_config(), (0, 3), 1e-3
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), (1, 2), 1e-5 yield self.create_inference_config(), (1, 2), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), (1, 2), 1e-3 yield self.create_inference_config(), (1, 2), 1e-3
def test(self): def test(self):
......
...@@ -100,10 +100,12 @@ class TrtConvertSplitTest(TrtLayerAutoScanTest): ...@@ -100,10 +100,12 @@ class TrtConvertSplitTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -111,10 +113,12 @@ class TrtConvertSplitTest(TrtLayerAutoScanTest): ...@@ -111,10 +113,12 @@ class TrtConvertSplitTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -206,10 +206,12 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest): ...@@ -206,10 +206,12 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
...@@ -217,10 +219,12 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest): ...@@ -217,10 +219,12 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
......
...@@ -153,10 +153,12 @@ class TrtConvertYoloBoxTest(TrtLayerAutoScanTest): ...@@ -153,10 +153,12 @@ class TrtConvertYoloBoxTest(TrtLayerAutoScanTest):
# for static_shape # for static_shape
clear_dynamic_shape() clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False attrs, False
), 1e-3 ), 1e-3
...@@ -164,10 +166,12 @@ class TrtConvertYoloBoxTest(TrtLayerAutoScanTest): ...@@ -164,10 +166,12 @@ class TrtConvertYoloBoxTest(TrtLayerAutoScanTest):
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-5 ), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
program_config.set_input_type(np.float16)
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True attrs, True
), 1e-3 ), 1e-3
......
...@@ -79,6 +79,7 @@ class TrtConvertYoloBoxHeadTest(TrtLayerAutoScanTest): ...@@ -79,6 +79,7 @@ class TrtConvertYoloBoxHeadTest(TrtLayerAutoScanTest):
) -> (paddle_infer.Config, List[int], float): ) -> (paddle_infer.Config, List[int], float):
# for static_shape # for static_shape
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.create_inference_config(), [1, 2], 1e-5 yield self.create_inference_config(), [1, 2], 1e-5
def test(self): def test(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册