未验证 提交 36ab58f8 编写于 作者: Z zlsh80826 提交者: GitHub

Loose TRT half test tolerance to 1e-3 (#47101)

上级 b3afac8a
...@@ -134,7 +134,7 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest): ...@@ -134,7 +134,7 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest):
attrs, False), 1e-5 attrs, False), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), 1e-5 attrs, False), 1e-3
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
...@@ -143,7 +143,7 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest): ...@@ -143,7 +143,7 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest):
attrs, True), 1e-5 attrs, True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True), 1e-5 attrs, True), 1e-3
def test(self): def test(self):
self.run_test() self.run_test()
......
...@@ -120,7 +120,7 @@ class TrtConvertArgMaxTest(TrtLayerAutoScanTest): ...@@ -120,7 +120,7 @@ class TrtConvertArgMaxTest(TrtLayerAutoScanTest):
attrs, False), 1e-5 attrs, False), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), 1e-5 attrs, False), 1e-3
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
...@@ -129,7 +129,7 @@ class TrtConvertArgMaxTest(TrtLayerAutoScanTest): ...@@ -129,7 +129,7 @@ class TrtConvertArgMaxTest(TrtLayerAutoScanTest):
attrs, True), 1e-5 attrs, True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True), 1e-5 attrs, True), 1e-3
def test(self): def test(self):
self.run_test() self.run_test()
......
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from trt_layer_auto_scan_test import TrtLayerAutoScanTest, SkipReasons from trt_layer_auto_scan_test import TrtLayerAutoScanTest
from program_config import TensorConfig, ProgramConfig from program_config import TensorConfig, ProgramConfig
import numpy as np import numpy as np
import paddle.inference as paddle_infer import paddle.inference as paddle_infer
from functools import partial from functools import partial
from typing import Optional, List, Callable, Dict, Any, Set from typing import List
import unittest import unittest
import os import os
...@@ -101,7 +101,7 @@ class TrtConvertBmmTest_dynamic(TrtLayerAutoScanTest): ...@@ -101,7 +101,7 @@ class TrtConvertBmmTest_dynamic(TrtLayerAutoScanTest):
attrs, False), 1e-5 attrs, False), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), 1e-5 attrs, False), 1e-3
# The output has little diff between gpu and trt in CI-Windows-Inference # The output has little diff between gpu and trt in CI-Windows-Inference
tol_fp32 = 1e-4 tol_fp32 = 1e-4
......
...@@ -138,7 +138,7 @@ class TrtConvertClipTest(TrtLayerAutoScanTest): ...@@ -138,7 +138,7 @@ class TrtConvertClipTest(TrtLayerAutoScanTest):
attrs, False), 1e-5 attrs, False), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), 1e-5 attrs, False), 1e-3
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
...@@ -147,7 +147,7 @@ class TrtConvertClipTest(TrtLayerAutoScanTest): ...@@ -147,7 +147,7 @@ class TrtConvertClipTest(TrtLayerAutoScanTest):
attrs, True), 1e-5 attrs, True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True), 1e-5 attrs, True), 1e-3
def test(self): def test(self):
self.run_test() self.run_test()
......
...@@ -299,7 +299,7 @@ class TrtConvertConcatTest(TrtLayerAutoScanTest): ...@@ -299,7 +299,7 @@ class TrtConvertConcatTest(TrtLayerAutoScanTest):
attrs, False), 1e-5 attrs, False), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), 1e-5 attrs, False), 1e-3
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
...@@ -308,7 +308,7 @@ class TrtConvertConcatTest(TrtLayerAutoScanTest): ...@@ -308,7 +308,7 @@ class TrtConvertConcatTest(TrtLayerAutoScanTest):
attrs, True), 1e-5 attrs, True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True), 1e-5 attrs, True), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
......
...@@ -181,7 +181,7 @@ class TrtConvertConv2dTransposeTest(TrtLayerAutoScanTest): ...@@ -181,7 +181,7 @@ class TrtConvertConv2dTransposeTest(TrtLayerAutoScanTest):
attrs, False), 1e-5 attrs, False), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), (1e-5, 1e-3) attrs, False), (1e-3, 1e-3)
# self.trt_param.precision = paddle_infer.PrecisionType.Int8 # self.trt_param.precision = paddle_infer.PrecisionType.Int8
# yield self.create_inference_config(), generate_trt_nodes_num( # yield self.create_inference_config(), generate_trt_nodes_num(
# attrs, False), (1e-5, 1e-5) # attrs, False), (1e-5, 1e-5)
...@@ -193,7 +193,7 @@ class TrtConvertConv2dTransposeTest(TrtLayerAutoScanTest): ...@@ -193,7 +193,7 @@ class TrtConvertConv2dTransposeTest(TrtLayerAutoScanTest):
attrs, True), 1e-5 attrs, True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True), (1e-5, 1e-3) attrs, True), (1e-3, 1e-3)
# self.trt_param.precision = paddle_infer.PrecisionType.Int8 # self.trt_param.precision = paddle_infer.PrecisionType.Int8
# yield self.create_inference_config(), generate_trt_nodes_num( # yield self.create_inference_config(), generate_trt_nodes_num(
# attrs, True), (1e-5, 1e-5) # attrs, True), (1e-5, 1e-5)
......
...@@ -131,7 +131,7 @@ class TrtConvertDropoutTest(TrtLayerAutoScanTest): ...@@ -131,7 +131,7 @@ class TrtConvertDropoutTest(TrtLayerAutoScanTest):
attrs, False), 1e-5 attrs, False), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), 1e-5 attrs, False), 1e-3
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
...@@ -140,7 +140,7 @@ class TrtConvertDropoutTest(TrtLayerAutoScanTest): ...@@ -140,7 +140,7 @@ class TrtConvertDropoutTest(TrtLayerAutoScanTest):
attrs, True), 1e-5 attrs, True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True), 1e-5 attrs, True), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
pass pass
......
...@@ -147,7 +147,7 @@ class TrtConvertElementwiseTest_one_input_corner_case(TrtLayerAutoScanTest): ...@@ -147,7 +147,7 @@ class TrtConvertElementwiseTest_one_input_corner_case(TrtLayerAutoScanTest):
attrs, False), 1e-5 attrs, False), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), 1e-5 attrs, False), 1e-3
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
...@@ -156,7 +156,7 @@ class TrtConvertElementwiseTest_one_input_corner_case(TrtLayerAutoScanTest): ...@@ -156,7 +156,7 @@ class TrtConvertElementwiseTest_one_input_corner_case(TrtLayerAutoScanTest):
attrs, True), 1e-5 attrs, True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True), 1e-5 attrs, True), 1e-3
def test(self): def test(self):
self.run_test() self.run_test()
......
...@@ -184,7 +184,7 @@ class TrtConvertGatherTest(TrtLayerAutoScanTest): ...@@ -184,7 +184,7 @@ class TrtConvertGatherTest(TrtLayerAutoScanTest):
False), 1e-5 False), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
False), 1e-5 False), 1e-3
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
......
...@@ -95,14 +95,14 @@ class TrtConvertGatherNdTest_dim_4_1(TrtLayerAutoScanTest): ...@@ -95,14 +95,14 @@ class TrtConvertGatherNdTest_dim_4_1(TrtLayerAutoScanTest):
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.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
yield self.create_inference_config(), (0, 4), 1e-5 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
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
yield self.create_inference_config(), (1, 3), 1e-5 yield self.create_inference_config(), (1, 3), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
...@@ -188,14 +188,14 @@ class TrtConvertGatherNdTest_dim_4_1_2(TrtLayerAutoScanTest): ...@@ -188,14 +188,14 @@ class TrtConvertGatherNdTest_dim_4_1_2(TrtLayerAutoScanTest):
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.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
yield self.create_inference_config(), (0, 4), 1e-5 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
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
yield self.create_inference_config(), (1, 3), 1e-5 yield self.create_inference_config(), (1, 3), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
...@@ -281,14 +281,14 @@ class TrtConvertGatherNdTest_dim_4_2(TrtLayerAutoScanTest): ...@@ -281,14 +281,14 @@ class TrtConvertGatherNdTest_dim_4_2(TrtLayerAutoScanTest):
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.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
yield self.create_inference_config(), (0, 4), 1e-5 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
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
yield self.create_inference_config(), (1, 3), 1e-5 yield self.create_inference_config(), (1, 3), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
...@@ -374,14 +374,14 @@ class TrtConvertGatherNdTest_dim_4_3(TrtLayerAutoScanTest): ...@@ -374,14 +374,14 @@ class TrtConvertGatherNdTest_dim_4_3(TrtLayerAutoScanTest):
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.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
yield self.create_inference_config(), (0, 4), 1e-5 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
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
yield self.create_inference_config(), (1, 3), 1e-5 yield self.create_inference_config(), (1, 3), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
...@@ -467,14 +467,14 @@ class TrtConvertGatherNdTest_dim_2_2(TrtLayerAutoScanTest): ...@@ -467,14 +467,14 @@ class TrtConvertGatherNdTest_dim_2_2(TrtLayerAutoScanTest):
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.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
yield self.create_inference_config(), (0, 4), 1e-5 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
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
yield self.create_inference_config(), (1, 3), 1e-5 yield self.create_inference_config(), (1, 3), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
...@@ -561,14 +561,14 @@ class TrtConvertGatherNdTest_dim_3_3(TrtLayerAutoScanTest): ...@@ -561,14 +561,14 @@ class TrtConvertGatherNdTest_dim_3_3(TrtLayerAutoScanTest):
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.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
yield self.create_inference_config(), (0, 4), 1e-5 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
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
yield self.create_inference_config(), (1, 3), 1e-5 yield self.create_inference_config(), (1, 3), 1e-3
def test(self): def test(self):
self.run_test() self.run_test()
......
...@@ -126,7 +126,7 @@ class TrtConvertGeluTest(TrtLayerAutoScanTest): ...@@ -126,7 +126,7 @@ class TrtConvertGeluTest(TrtLayerAutoScanTest):
attrs, False), 1e-5 attrs, False), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), 1e-5 attrs, False), 1e-3
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
...@@ -135,7 +135,7 @@ class TrtConvertGeluTest(TrtLayerAutoScanTest): ...@@ -135,7 +135,7 @@ class TrtConvertGeluTest(TrtLayerAutoScanTest):
attrs, True), 1e-5 attrs, True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True), 1e-5 attrs, True), 1e-3
def test(self): def test(self):
self.run_test() self.run_test()
......
...@@ -120,7 +120,7 @@ class TrtConvertGroupNormTest(TrtLayerAutoScanTest): ...@@ -120,7 +120,7 @@ class TrtConvertGroupNormTest(TrtLayerAutoScanTest):
attrs, False), 1e-5 attrs, False), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), 1e-5 attrs, False), 1e-3
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
...@@ -129,7 +129,7 @@ class TrtConvertGroupNormTest(TrtLayerAutoScanTest): ...@@ -129,7 +129,7 @@ class TrtConvertGroupNormTest(TrtLayerAutoScanTest):
attrs, True), 1e-5 attrs, True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True), 1e-5 attrs, True), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
pass pass
......
...@@ -98,14 +98,14 @@ class TrtConvertHardSigmoidTest_dim_2(TrtLayerAutoScanTest): ...@@ -98,14 +98,14 @@ class TrtConvertHardSigmoidTest_dim_2(TrtLayerAutoScanTest):
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.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
yield self.create_inference_config(), (1, 2), 1e-5 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
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
yield self.create_inference_config(), (1, 2), 1e-5 yield self.create_inference_config(), (1, 2), 1e-3
def test(self): def test(self):
self.run_test() self.run_test()
......
...@@ -100,7 +100,7 @@ class TrtConvertHardSwishTest(TrtLayerAutoScanTest): ...@@ -100,7 +100,7 @@ class TrtConvertHardSwishTest(TrtLayerAutoScanTest):
attrs, False), 1e-5 attrs, False), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), (1e-5, 1e-5) attrs, False), (1e-3, 1e-3)
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
...@@ -109,7 +109,7 @@ class TrtConvertHardSwishTest(TrtLayerAutoScanTest): ...@@ -109,7 +109,7 @@ class TrtConvertHardSwishTest(TrtLayerAutoScanTest):
attrs, True), 1e-5 attrs, True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True), (1e-5, 1e-5) attrs, True), (1e-3, 1e-3)
def test(self): def test(self):
self.run_test() self.run_test()
......
...@@ -104,10 +104,10 @@ class TrtConvertLeakyReluTest(TrtLayerAutoScanTest): ...@@ -104,10 +104,10 @@ class TrtConvertLeakyReluTest(TrtLayerAutoScanTest):
attrs, False), 1e-5 attrs, False), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), (1e-5, 1e-5) attrs, False), (1e-3, 1e-3)
self.trt_param.precision = paddle_infer.PrecisionType.Int8 self.trt_param.precision = paddle_infer.PrecisionType.Int8
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), (1e-5, 1e-5) attrs, False), (1e-3, 1e-3)
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
...@@ -116,10 +116,10 @@ class TrtConvertLeakyReluTest(TrtLayerAutoScanTest): ...@@ -116,10 +116,10 @@ class TrtConvertLeakyReluTest(TrtLayerAutoScanTest):
attrs, True), 1e-5 attrs, True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True), (1e-5, 1e-5) attrs, True), (1e-3, 1e-3)
self.trt_param.precision = paddle_infer.PrecisionType.Int8 self.trt_param.precision = paddle_infer.PrecisionType.Int8
yield self.create_inference_config(), generate_trt_nodes_num( yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True), (1e-5, 1e-5) attrs, True), (1e-3, 1e-3)
def test(self): def test(self):
self.run_test() self.run_test()
......
...@@ -102,7 +102,7 @@ class TrtConvertMatmulTest_static(TrtLayerAutoScanTest): ...@@ -102,7 +102,7 @@ class TrtConvertMatmulTest_static(TrtLayerAutoScanTest):
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.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
yield self.create_inference_config(), (1, 3), 1e-5 yield self.create_inference_config(), (1, 3), 1e-3
def test(self): def test(self):
self.run_test() self.run_test()
...@@ -198,7 +198,7 @@ class TrtConvertMatmulTest_dynamic(TrtLayerAutoScanTest): ...@@ -198,7 +198,7 @@ class TrtConvertMatmulTest_dynamic(TrtLayerAutoScanTest):
self.trt_param.precision = paddle_infer.PrecisionType.Float32 self.trt_param.precision = paddle_infer.PrecisionType.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
yield self.create_inference_config(), (1, 3), 1e-5 yield self.create_inference_config(), (1, 3), 1e-3
def add_skip_trt_case(self): def add_skip_trt_case(self):
pass pass
......
...@@ -427,7 +427,7 @@ class TrtConvertMultiHeadMatmulTest(TrtLayerAutoScanTest): ...@@ -427,7 +427,7 @@ class TrtConvertMultiHeadMatmulTest(TrtLayerAutoScanTest):
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
yield self.create_inference_config(), (1, 4), (1e-5, 1e-5) yield self.create_inference_config(), (1, 4), (1e-3, 1e-3)
# for dynamic_shape # for dynamic_shape
generate_dynamic_shape(attrs) generate_dynamic_shape(attrs)
...@@ -435,7 +435,7 @@ class TrtConvertMultiHeadMatmulTest(TrtLayerAutoScanTest): ...@@ -435,7 +435,7 @@ class TrtConvertMultiHeadMatmulTest(TrtLayerAutoScanTest):
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
yield self.create_inference_config(), (1, 3), (1e-5, 1e-5) yield self.create_inference_config(), (1, 3), (1e-3, 1e-3)
def add_skip_trt_case(self): def add_skip_trt_case(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册