未验证 提交 a540769b 编写于 作者: W Wilber 提交者: GitHub

[cherry-pick] enable trt test check and fix trt ut error (#36549) (#36655)

上级 0951bfd1
......@@ -1155,6 +1155,14 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
return false;
}
}
#if IS_TRT_VERSION_LT(7000)
if (!with_dynamic_shape) {
// TODO(inference): fix trt6 static plugin error.
VLOG(3) << "prelu static plugin in trt6 has bug.";
return false;
}
#endif
}
if (op_type == "roi_align") {
......
......@@ -14,6 +14,7 @@
from trt_layer_auto_scan_test import TrtLayerAutoScanTest, SkipReasons
from program_config import TensorConfig, ProgramConfig
import unittest
import numpy as np
import paddle.inference as paddle_infer
from functools import partial
......
......@@ -14,6 +14,7 @@
from trt_layer_auto_scan_test import TrtLayerAutoScanTest, SkipReasons
from program_config import TensorConfig, ProgramConfig
import unittest
import numpy as np
import paddle.inference as paddle_infer
from functools import partial
......
......@@ -14,6 +14,7 @@
from trt_layer_auto_scan_test import TrtLayerAutoScanTest, SkipReasons
from program_config import TensorConfig, ProgramConfig
import unittest
import numpy as np
import paddle.inference as paddle_infer
from functools import partial
......
......@@ -14,6 +14,7 @@
from trt_layer_auto_scan_test import TrtLayerAutoScanTest, SkipReasons
from program_config import TensorConfig, ProgramConfig
import unittest
import numpy as np
import paddle.inference as paddle_infer
from functools import partial
......@@ -73,6 +74,16 @@ class TrtConvertFlattenTest_dim_2(TrtLayerAutoScanTest):
self.dynamic_shape.opt_input_shape = {}
def generate_trt_nodes_num(attrs, dynamic_shape):
ver = paddle_infer.get_trt_compile_version()
if ver[0] * 1000 + ver[1] * 100 + ver[0] * 10 >= 7130:
if attrs[0]['axis'] == 1:
return 1, 2
else:
return 0, 3
else:
if dynamic_shape:
return 0, 3
if attrs[0]['axis'] == 1:
return 1, 2
else:
......@@ -157,6 +168,16 @@ class TrtConvertFlattenTest_dim_3(TrtLayerAutoScanTest):
self.dynamic_shape.opt_input_shape = {}
def generate_trt_nodes_num(attrs, dynamic_shape):
ver = paddle_infer.get_trt_compile_version()
if ver[0] * 1000 + ver[1] * 100 + ver[0] * 10 >= 7130:
if attrs[0]['axis'] == 1:
return 1, 2
else:
return 0, 3
else:
if dynamic_shape:
return 0, 3
if attrs[0]['axis'] == 1:
return 1, 2
else:
......@@ -241,6 +262,16 @@ class TrtConvertFlattenTest_dim_4(TrtLayerAutoScanTest):
self.dynamic_shape.opt_input_shape = {}
def generate_trt_nodes_num(attrs, dynamic_shape):
ver = paddle_infer.get_trt_compile_version()
if ver[0] * 1000 + ver[1] * 100 + ver[0] * 10 >= 7130:
if attrs[0]['axis'] == 1:
return 1, 2
else:
return 0, 3
else:
if dynamic_shape:
return 0, 3
if attrs[0]['axis'] == 1:
return 1, 2
else:
......@@ -325,6 +356,16 @@ class TrtConvertFlattenTest_dim_5(TrtLayerAutoScanTest):
self.dynamic_shape.opt_input_shape = {}
def generate_trt_nodes_num(attrs, dynamic_shape):
ver = paddle_infer.get_trt_compile_version()
if ver[0] * 1000 + ver[1] * 100 + ver[0] * 10 >= 7130:
if attrs[0]['axis'] == 1:
return 1, 2
else:
return 0, 3
else:
if dynamic_shape:
return 0, 3
if attrs[0]['axis'] == 1:
return 1, 2
else:
......
......@@ -19,6 +19,7 @@ import paddle.inference as paddle_infer
from functools import partial
from typing import Optional, List, Callable, Dict, Any, Set
import logging
import unittest
class TrtConvertGatherTest(TrtLayerAutoScanTest):
......
......@@ -18,6 +18,7 @@ import numpy as np
import paddle.inference as paddle_infer
from functools import partial
from typing import Optional, List, Callable, Dict, Any, Set
import unittest
class TrtConvertGatherNdTest_dim_4_1(TrtLayerAutoScanTest):
......
......@@ -18,6 +18,7 @@ import numpy as np
import paddle.inference as paddle_infer
from functools import partial
from typing import Optional, List, Callable, Dict, Any, Set
import unittest
class TrtConvertGeluTest(TrtLayerAutoScanTest):
......
......@@ -18,6 +18,7 @@ import numpy as np
import paddle.inference as paddle_infer
from functools import partial
from typing import Optional, List, Callable, Dict, Any, Set
import unittest
class TrtConvertGroupNormTest(TrtLayerAutoScanTest):
......
......@@ -18,6 +18,7 @@ import numpy as np
import paddle.inference as paddle_infer
from functools import partial
from typing import Optional, List, Callable, Dict, Any, Set
import unittest
class TrtConvertPreluTest(TrtLayerAutoScanTest):
......@@ -186,6 +187,19 @@ class TrtConvertPreluTest(TrtLayerAutoScanTest):
"Need to repair the case: the output of GPU and tensorrt has diff when the input dimension is 2 in static shape mode."
)
ver = paddle_infer.get_trt_compile_version()
if ver[0] * 1000 + ver[1] * 100 + ver[0] * 10 < 7000:
def teller(program_config, predictor_config):
if not predictor_config.tensorrt_dynamic_shape_enabled():
return True
return False
self.add_skip_case(
teller, SkipReasons.TRT_NOT_IMPLEMENTED,
"Need to repair the case: the output of GPU and tensorrt has diff in trt6, the prelu static plugin has bug."
)
def test(self):
self.add_skip_trt_case()
self.run_test()
......
......@@ -18,6 +18,7 @@ import numpy as np
import paddle.inference as paddle_infer
from functools import partial
from typing import Optional, List, Callable, Dict, Any, Set
import unittest
class TrtConvertReshapeTest(TrtLayerAutoScanTest):
......
......@@ -18,6 +18,7 @@ import numpy as np
import paddle.inference as paddle_infer
from functools import partial
from typing import Optional, List, Callable, Dict, Any, Set
import unittest
class TrtConvertScaleTest(TrtLayerAutoScanTest):
......
......@@ -18,6 +18,7 @@ import numpy as np
import paddle.inference as paddle_infer
from functools import partial
from typing import Optional, List, Callable, Dict, Any, Set
import unittest
class TrtConvertShuffleChannelTest(TrtLayerAutoScanTest):
......
......@@ -18,6 +18,7 @@ import numpy as np
import paddle.inference as paddle_infer
from functools import partial
from typing import Optional, List, Callable, Dict, Any, Set
import unittest
class TrtConvertSwishTest(TrtLayerAutoScanTest):
......
......@@ -18,6 +18,7 @@ import numpy as np
import paddle.inference as paddle_infer
from functools import partial
from typing import Optional, List, Callable, Dict, Any, Set
import unittest
class TrtConvertTransposeTest(TrtLayerAutoScanTest):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册