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

update for trt convert ut. (#36549)

上级 8ca5206b
......@@ -1104,6 +1104,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 == "mish") {
......
......@@ -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
......
......@@ -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 TrtConvertEmbEltwiseLayernormTest1(TrtLayerAutoScanTest):
......
......@@ -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,10 +74,20 @@ class TrtConvertFlattenTest_dim_2(TrtLayerAutoScanTest):
self.dynamic_shape.opt_input_shape = {}
def generate_trt_nodes_num(attrs, dynamic_shape):
if attrs[0]['axis'] == 1:
return 1, 2
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:
return 0, 3
if dynamic_shape:
return 0, 3
if attrs[0]['axis'] == 1:
return 1, 2
else:
return 0, 3
attrs = [
program_config.ops[i].attrs
......@@ -157,10 +168,20 @@ class TrtConvertFlattenTest_dim_3(TrtLayerAutoScanTest):
self.dynamic_shape.opt_input_shape = {}
def generate_trt_nodes_num(attrs, dynamic_shape):
if attrs[0]['axis'] == 1:
return 1, 2
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:
return 0, 3
if dynamic_shape:
return 0, 3
if attrs[0]['axis'] == 1:
return 1, 2
else:
return 0, 3
attrs = [
program_config.ops[i].attrs
......@@ -241,10 +262,20 @@ class TrtConvertFlattenTest_dim_4(TrtLayerAutoScanTest):
self.dynamic_shape.opt_input_shape = {}
def generate_trt_nodes_num(attrs, dynamic_shape):
if attrs[0]['axis'] == 1:
return 1, 2
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:
return 0, 3
if dynamic_shape:
return 0, 3
if attrs[0]['axis'] == 1:
return 1, 2
else:
return 0, 3
attrs = [
program_config.ops[i].attrs
......@@ -325,10 +356,20 @@ class TrtConvertFlattenTest_dim_5(TrtLayerAutoScanTest):
self.dynamic_shape.opt_input_shape = {}
def generate_trt_nodes_num(attrs, dynamic_shape):
if attrs[0]['axis'] == 1:
return 1, 2
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:
return 0, 3
if dynamic_shape:
return 0, 3
if attrs[0]['axis'] == 1:
return 1, 2
else:
return 0, 3
attrs = [
program_config.ops[i].attrs
......
......@@ -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.
先完成此消息的编辑!
想要评论请 注册